var popWindow;

var videoWindow;

var videoWindowF;

var currentVideo=null;

var currentVideoTitle="";

var currentItem="";

var currentChapter=1;

//window.onload=initPage;

//初始化

function initPage(){

adjustIFrameSize()

bindIframeEvt()

}

function bindIframeEvt(){

// 为IFRAME绑定onload事件

var cnt=document.getElementById("rightmain");

if (cnt.addEventListener) {

cnt.addEventListener("load", adjustIFrameSize, false);

} else {

cnt.attachEvent("onload", adjustIFrameSize);

}

}

//iframe 控制

function adjustIFrameSize() {

var myIframe = document.getElementById("rightmain");

if (myIframe) {

if (myIframe.contentDocument && myIframe.contentDocument.body.offsetHeight) {

// W3C DOM (and Mozilla) syntax

if(myIframe.contentDocument.body.offsetHeight>screen.availHeight-404){

myIframe.height = myIframe.contentDocument.body.offsetHeight+100;

}else{

myIframe.height =screen.availHeight-374

}


} else if (myIframe.Document && myIframe.Document.body.scrollHeight) {

// IE DOM syntax

if(myIframe.Document.body.scrollHeight>screen.availHeight-404){

myIframe.height = myIframe.Document.body.scrollHeight+100;

}else{

myIframe.height=screen.availHeight-374

}

}

}

}

function showTips(target){

target.blur()

var theElement=target.nextSibling

if(theElement.style.display=="inline"){

theElement.style.display="none"

}else{

theElement.style.display="inline"

}

adjustIFrameSize()


}

function showHideAnswer(target){

target.blur()

var theElement=target.parentNode.parentNode.nextSibling

//alert(theElement.style.display)

if(theElement.style.display=="block"){

theElement.style.display="none"

}else{

theElement.style.display="block"

}

adjustIFrameSize()


}

function showHideNote(target){

target.blur()

var theElement=target.parentNode.parentNode.nextSibling

//alert(theElement.style.display)

if(theElement.style.display=="block"){

theElement.style.display="none"

}else{

theElement.style.display="block"

}

adjustIFrameSize()


}

////////////////////////////

function launchVideo(videoID,videoTitle,cc){

if(videoWindowF){

videoWindowF.close();

}

currentVideo=videoID;

currentVideoTitle=videoTitle;

currentChapter=cc;

var videoDirectory=""

if(currentItem=="videolist"){

videoDirectory="../../media/";

}else{

videoDirectory="../../media/";

}

//alert(window.location.href)

videoWindow= window.open(videoDirectory+"videoplayer.html","videos","width=470,height=510,resizable=no,scrollbars=no");

videoWindow.moveTo(0,0);

videoWindow.focus();

}

function launchVideo_f(videoID,videoTitle){

if(videoWindow){

videoWindow.close();

}

if(videoID){

currentVideo=videoID;

}

if(videoTitle){

currentVideoTitle=videoTitle;

}

var videoDirectory="";

var theW=780;

if(screen.availWidth){

theW=screen.availWidth-10;

}

var theH=560;

if(screen.availHeight){

theH=screen.availHeight-40;

}

videoWindowF= window.open(videoDirectory+"videoplayer_f.html","videos_f","width="+theW+",height="+theH+",resizable=yes,scrollbars=no");

videoWindowF.moveTo(0,0);

videoWindowF.focus();

}

////////////////////////////////

function launchQuiz(quizID){

var quizURL=quizID+".html"

popWindow= window.open(quizURL,"popwin","width=579,height=600,resizable=no,scrollbars=yes");

popWindow.focus();

}

function launchReadings(readingID){


var readingURL="readings/"+readingID+".html";

popWindow= window.open(readingURL,"popwin","width=579,height=600,resizable=no,scrollbars=yes");

popWindow.focus();


}

function launchReference(referenceID){


var referenceURL="../references/"+referenceID+".html";

popWindow= window.open(referenceURL,"popwin","width=579,height=550,resizable=no,scrollbars=yes");

popWindow.focus();



}