//------------------------------------------------
// sType = 
// img - Images (jpg, gif)
// swf - Flash movies
// mov - QuickTime movies
//------------------------------------------------

var winPop = window;
var iPreferredLeft = 200;
var iPreferredTop = 100;
var bIsClosed;
window.self.name = 'ThisCouldBeAnywhere';

//alert(bIsClosed);

if(bIsClosed==undefined){
	bIsClosed = true;
}


function ContentPopperIMG(sContent,sCaption,iWidth,iHeight,bScrollBars){

	//-------------------------------------------------------------
	// Calculate window dimesions so as to accomodate the image:
	//-------------------------------------------------------------

	var iWindowWidth = parseInt(iWidth) + 30;
	var iWindowHeight = parseInt(iHeight) + 80;


	//-------------------------------------------------------------
	// R = (screen width - the width of the pop window) - the required amount of gutter/margin:
	//-------------------------------------------------------------
	var R = new Number((screen.availWidth-iWindowWidth)-250);
	//var D = new Number((screen.availHeight-343)-250);

	//alert('screen.availWidth: ' + screen.availWidth + '\n iWindowWidth: ' + iWindowWidth + '\n R: ' + R);

	iPreferredLeft=200;


	//---------------------------------------------------------------------
	// Open window:
	//---------------------------------------------------------------------

	if(bScrollBars=='y'){
		winPop = window.open('/pop_img.aspx?sContent=' + sContent + '&sCaption=' + escape(sCaption) + '&w=' + iWindowWidth + '&h=' + iWindowHeight,'winPop','resizable,scrollbars,location=no,status=no,menubar=no,toolbar=no,directories=no,width=' + iWindowWidth + ',height=' + iWindowHeight);
	} else {
		winPop = window.open('/pop_img.aspx?sContent=' + sContent + '&sCaption=' + escape(sCaption) + '&w=' + iWindowWidth + '&h=' + iWindowHeight,'winPop','resizable,location=no,status=no,menubar=no,toolbar=no,directories=no,width=' + iWindowWidth + ',height=' + iWindowHeight);
	}
	winPop.focus();


	//---------------------------------------------------------------------
	// size + position winPop based on above calculations, 
	// But only reposition if the window isn't open already.
	// If it is, the user may have moved it to a preferred location.
	//---------------------------------------------------------------------

	//if(bIsClosed==true){
		// window isn't open already, prepare to move to desire location:

			if(R>0){
				//alert('move ' + iPreferredLeft);
				winPop.moveTo(iPreferredLeft, 30)
			} else {
				//alert('move else ' + iPreferredLeft);
				winPop.moveTo(10, 30)
			}
	//}
	winPop.focus();
	//alert(R);
}



function ContentPopperSWF(sContent){

	iPreferredLeft=200

	//---------------------------------------------------------------------
	// Open window:
	//---------------------------------------------------------------------

	winPop = window.open('/pop_swf.asp?sContent=' + sContent,'winPop','resizable,location=no,status=no,menubar=no,toolbar=no,directories=no,width=465,height=370');
	winPop.focus();


	//---------------------------------------------------------------------
	// size + position winPop based on above calculations, 
	// But only reposition if the window isn't open already.
	// If it is, the user may have moved it to a preferred location.
	//---------------------------------------------------------------------

	//if(bIsClosed==true){
		// window isn't open already, prepare to move to desire location:

			if(screen.availWidth>=800){
				//alert('move ' + iPreferredLeft);
				winPop.moveTo(iPreferredLeft, 30)
			} else {
				//alert('move else ' + iPreferredLeft);
				winPop.moveTo(10, 30)
			}
	//}
	winPop.focus();
	//alert(R);
}




function ContentPopperQTVR(sContent){

	//-------------------------------------------------------------
	// R = (screen width - the width of the pop window) - the 
	// required amount of gutter/margin:
	//-------------------------------------------------------------
	var R = new Number((screen.availWidth-343)-250);
	//var D = new Number((screen.availHeight-343)-250);

	iPreferredLeft=200;


	//---------------------------------------------------------------------
	// Open window:
	//---------------------------------------------------------------------

	winPop = window.open('/pop_mov.asp?sContent=' + sContent + '&w=350&h=350', 'winPop', 'resizable,location=no,status=no,menubar=no,toolbar=no,directories=no,width=350,height=350');
	winPop.focus();


	//---------------------------------------------------------------------
	// size + position winPop based on above calculations, 
	// But only reposition if the window isn't open already.
	// If it is, the user may have moved it to a preferred location.
	//---------------------------------------------------------------------

	//if(bIsClosed==true){
		// window isn't open already, prepare to move to desire location:

			if(screen.availWidth>=800){
				//alert('move ' + iPreferredLeft);
				winPop.moveTo(iPreferredLeft, 30)
			} else {
				//alert('move else ' + iPreferredLeft);
				winPop.moveTo(10, 30)
			}
	//}
	winPop.focus();
	//alert(R);
}






function ContentPopperHelp(sContent,iWidth,iHeight){

	iPreferredLeft=200

	//---------------------------------------------------------------------
	// Open window:
	//---------------------------------------------------------------------

	winPop = window.open('/pop_help.asp?sContent=' + sContent + '','winPop','resizable,location=no,status=no,menubar=no,toolbar=no,directories=no,width=' + iWidth + ',height=' + iHeight);
	//winPop = window.open('https://www.ultimatehikes.co.nz/pop_help.asp?sContent=' + sContent + '','winPop','resizable,location=no,status=no,menubar=no,toolbar=no,directories=no,width=' + iWidth + ',height=' + iHeight);
	winPop.focus();


	//---------------------------------------------------------------------
	// size + position winPop based on above calculations, 
	// But only reposition if the window isn't open already.
	// If it is, the user may have moved it to a preferred location.
	//---------------------------------------------------------------------

	//if(bIsClosed==true){
		// window isn't open already, prepare to move to desire location:

			if(screen.availWidth>=800){
				//alert('move ' + iPreferredLeft);
				winPop.moveTo(iPreferredLeft, 30)
			} else {
				//alert('move else ' + iPreferredLeft);
				winPop.moveTo(10, 30)
			}
	//}
	winPop.focus();
	//alert(R);
}



function ContentPopperPage(sPageURL,iWidth,iHeight){

	iPreferredLeft=200

	//---------------------------------------------------------------------
	// Open window:
	//---------------------------------------------------------------------

	winPop = window.open('/' + sPageURL,'winPop','resizable,scrollbars=yes,location=no,status=no,menubar=no,toolbar=no,directories=no,width=' + iWidth + ',height=' + iHeight);
	//winPop = window.open(sPageURL,'winPop','resizable,scrollbars=yes,location=no,status=no,menubar=no,toolbar=no,directories=no,width=' + iWidth + ',height=' + iHeight);
	winPop.focus();


	//---------------------------------------------------------------------
	// size + position winPop based on above calculations, 
	// But only reposition if the window isn't open already.
	// If it is, the user may have moved it to a preferred location.
	//---------------------------------------------------------------------

	//if(bIsClosed==true){
		// window isn't open already, prepare to move to desire location:

			if(screen.availWidth>=800){
				//alert('move ' + iPreferredLeft);
				winPop.moveTo(iPreferredLeft, 30)
			} else {
				//alert('move else ' + iPreferredLeft);
				winPop.moveTo(10, 30)
			}
	//}
	winPop.focus();
	//alert(R);
}



