function doXReminder() {
    var ns6=document.getElementById&&!document.all;
    if (navigator.userAgent.indexOf("MSIE") > -1 || ns6 ) {
        parent.CloseReminder( 'slideContent');
    } else {    
        window.close();             
    }
}

function DisplayReminder( name , newReelID, newPVID, iwidth , iheight , autoclose , duration , islide, isV2, referenceID, ctTypeID ) {
    if (slidePanelActive)  {
        clearInterval(surveyIntervalID);
        secs = 0;
    } else {
        slidePanelActive = true;
    }
    
    if (isV2) {
    
        if (IE || ns6) {
            slideType = "IE";   
            scroll(0,0); 
            clearInterval(intervalID);
            
            if(ns6) {
                controlBannerFlash();
                document.getElementById("scrollDiv").className="scrollHide";
                layerFrame =  document.getElementById("slideContent").style ;
                layerFrame.visibility="visible";
                layerFrame.display="block";
            } else {
                document.all["scrollDiv"].className="scrollHide";
            }
                
            with ( slideBanner = cbeGetElementById( name ).cbe) {
                resizeTo( iwidth , iheight );
                if( islide == 1 ) {
                    moveTo( 144 , -10 * height());
                    show();
                    slideTo(144, 0 , 1000);
                } else {
                    moveTo( 1, 1);
                    show();
                }
            }
            if ( autoclose == 0 ) {
                timerid = setTimeout( "CloseSlide( '" + name + "' , '" + islide  + "')", duration );
            }
        } else {
            slideType = "OTHER";
            window.open(getUrl(newPVID, newReelID, referenceID, ctTypeID), 'container', 'width=780,height=600,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,location=no');
        }       
    } else {
        // This is a version 1 popup.
        var baseURL = "http://ww3.peerviewpress.com/misc/fc.nsf/dispatch/" + scrollingLinksArray[currentScrollIndex].pvName;    
        var windowHeight = scrollingLinksArray[currentScrollIndex].windowHeight;
        var url = baseURL + '?OpenDocument&ref=' + fcPageType + '&video=' + scrollingLinksArray[currentScrollIndex].reelID + "&dist=" + distType + "&num=" + distNumber;
                                
        WindowWidth=700;
        leftPosition = (screen.width) ? (screen.width-WindowWidth)/2 : 0;
        topPosition = (screen.height) ? (screen.height-windowHeight)/2 : 0;
        window.open(url,"container","width=700,height=" + windowHeight + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",top=" + topPosition + ",left=" + leftPosition + ",menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,location=no");
        
        scrollerClickThroughNumber = -1;
        scrollerRequestedNumber = 1;
    }       
    
}

/**
 *
 */
function doX() {
	var isSafari = (navigator.userAgent.toLowerCase().indexOf("safari") != -1);
		
	var ns6=document.getElementById&&!document.all;
	StopPresentationTimer();


    if (TrimAll(forumLink) != ""){
		window.open(forumLink, "", 'width=' + exitWindowWidth + ',height=' + exitWindowHeight + ',menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,location=yes');
	} else {
    	showSurvey();
    }

	if ( !isSafari && (navigator.userAgent.indexOf("MSIE") > -1 || ns6) ) {
		parent.CloseSlide( 'slideContent' , 1 )
	} else { 	
 		window.close();  	 		
 	}
}


/**
 *
 */
function doXClose() {

	var isSafari = (navigator.userAgent.toLowerCase().indexOf("safari") != -1);
		
	var ns6=document.getElementById&&!document.all;
	StopPresentationTimer();

	showSurvey();
	if ( !isSafari && (navigator.userAgent.indexOf("MSIE") > -1 || ns6) ) {
		parent.CloseSlide( 'slideContent' , 1 )
	} else { 	
 		window.close();  	 		
 	}
}

function inSession_DoFSCommand(command, args) { 
    if ( command=="setScriptPage" ) {
        setScriptPage(args); 
    }
}

/**
* Used by the script window. Changes the window to the position passed
* as a parameter.
*/
function setScriptPage(locNum) {
	currentScriptPage = locNum;	
	changeScriptLocation(false, false);
}

function changeScriptLocation(forceNewWindow, focusNewWindow) {
	// stay on all.html for Internet Explorer
	var	url;
	if (navigator.userAgent.indexOf("MSIE")<0) {
		url=baseScriptURL + currentScriptLanguageFile + "/" + currentScriptPage + ".html";
		}
	else {
		url=baseScriptURL + currentScriptLanguageFile + "/all.html";
		}

	if (simpleVersion) {
		if (subscriptWindow != null || forceNewWindow) {
			subscriptWindow = window.open(url, 'transcript','width=400,height=300,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,location=no');	
			
			if (focusNewWindow) {
				subscriptWindow.focus();
			}
		}
	} else {
		if (document.getElementById('subtitles').src!=url) {
	        document.getElementById('subtitles').src = url;
	        }
	}	
}

/**
* Shows the script window with the selected language
*/
function showScript(languageName, languageNumber) {
	currentScriptLanguageID = languageNumber;
	currentScriptLanguageFile = languageName;
	changeScriptLocation(true, true);	
}

function goGatewayRedirect(pvid) {
    var refPvid = getQueryVariable("pvid"); 
    var reel = getQueryVariable("reel");
    var domain = getQueryVariable("domain"); 
    var domainToUse = 'http://www.peerviewpress.com';
    
    if (domain == 'docguide.com') {
        domainToUse = 'http://peerviewpress.docguide.com';
    } 
    
    location = domainToUse + '/fc/LoadFC.do?pvid=' + pvid + '&gateway=true&refid=' + refPvid + '&reel=' + reel + "&tid=" + getQueryVariable("tid") + "&ref=" + getQueryVariable("ref");    
}       

/**
* Stops or starts the flipping of the other presentations iframe.
*/ 
function changeOtherPresentationFlipState(state) {
	otherPresentationFlipState = state;
	return false;
}


/**
* Flips the other presentations location.
*/
function otherPresentationflip(maxReels, baseUrl) {
	if (currentPresentationFlip == 1 && otherPresentationFlipRotated) {
		changeOtherPresentationFlipState(false);
	}
	
	if (otherPresentationFlipState) {
		if (currentPresentationFlip == maxReels ) {
			currentPresentationFlip = 1;
		} else {
			currentPresentationFlip++;
		}			
		otherPresentations.document.location = baseUrl + "&start=" + currentPresentationFlip + "&cme=1&opurl=" + otherPresntationImportURL;
		otherPresentationFlipRotated = true;
	}
}

/**
* V4.01
*/
function MM_findObj(n, d) {
	var p,i,x;  
	
	if(!d) 
		d=document; 
		
	if ((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
		
	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
		
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
		
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=MM_findObj(n,d.layers[i].document);
		
	if(!x && d.getElementById) 
		x=d.getElementById(n); 
		
	return x;
}

/**
* V6.0
*/
function MM_showHideLayers() { 
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
		if ((obj=MM_findObj(args[i]))!=null) { 
			v=args[i+2];
   			if (obj.style) { 
				obj=obj.style; 
				v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
			}
			obj.visibility=v; 
		    if (obj.visibility == "visible" || obj.visibility == "show") {
		    	obj.left = "8px";
		    } else {
		    	obj.left = "0px";
		    }
		}
}