// JavaScript Document

//establish a vlaue for this variable so Facebox can netermine the centering height of the box
myFinalHeight = null;

// Adapted from getPageSize() by quirksmode.com
function getPageHeight() {
	var windowHeight
	if (self.innerHeight) {	// all except Explorer
	  windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	  windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
	  windowHeight = document.body.clientHeight;
	}	
	return windowHeight
}
function getPageWidth() {
	var windowWidth
	if (self.innerWidth) {	// all except Explorer
	  windowWidth = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) { // Explorer 6 Strict Mode
	  windowWidth = document.documentElement.clientWidth;
	} else if (document.body) { // other Explorers
	  windowWidth = document.body.clientWidth;
	}	
	return windowWidth
}

//if window is already open this function determines where it is, brings it into focus, then loads content.
var mainMovieWindow1 = null;
function popUpTest(theUrl){
	if (mainMovieWindow1 && !mainMovieWindow1.closed && mainMovieWindow1.open) {
		mainMovieWindow1.focus();
	} else {
		var screenWidth = screen.width;
		var screenHeight = screen.height;
		settings = "height="+Math.round(screenHeight*.95)+",width="+Math.round(screenWidth*.99)+",toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,left=0,top=0,screenX=0,screenY=0"
		mainMovieWindow1=window.open(theUrl,"dsmainmovie",settings);
	}
}

// End -->

<!-- Begin pop up window for PayPal Cart
var payPalWindowCartView = null;
function popUpPayPalCart(theUrl){
	if (payPalWindowCartView && !payPalWindowCartView.closed) {
		payPalWindowCartView.close();
	}
	var screenWidth = screen.width;
	var screenHeight = screen.height;
	settings = "height="+Math.round(screenHeight*.50)+",width="+Math.round(screenWidth*.50)+",toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,left=0,top=0,screenX=0,screenY=0"
	payPalWindowCartView=window.open(theUrl,"_popup",settings);
	return true;
}

<!-- Open PayPal Cart After Form Submit
function openPopupFormCart(){
	if (payPalWindowCartView && !payPalWindowCartView.closed) {
		payPalWindowCartView.close();
	}
	var screenWidth = screen.width;
	var screenHeight = screen.height;
	settings = "height="+Math.round(screenHeight*.50)+",width="+Math.round(screenWidth*.50)+",toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,left=0,top=0,screenX=0,screenY=0"
	payPalWindowCartView=window.open("","_popup",settings);
	return true;
}

<!-- Begin pop up window for PayPal
var payPalWindow = null;
function payPalPopUp(theURL,toPayPalURL){
	viewCartWindow = theURL+"?newURL="+toPayPalURL; //may be a call for viewing the cart
	theURL = (toPayPalURL != null) ? viewCartWindow : theURL
	if(theURL == viewCartWindow){ //must be the view cart button pressed in the client menu
		var colorBoxCartWindow = "/cart/shopping_cart.cfm";
		$.fn.colorbox({href:colorBoxCartWindow, innerWidth:"963", innerHeight:"565", iframe:true, scrolling:false, open:true});
	} else {
		var colorBoxCartWindow = theURL.replace("/Iphoto/cart1/paypal-main-box.cfm","/cart/add_to_cart.cfm");
		$.fn.colorbox({href:colorBoxCartWindow, innerWidth:"963", innerHeight:"565", iframe:true, scrolling:false, open:true});
	}
}



<!-- Begin pop up window for cart pop up
var win2= null;
function popUp2(URL) {
win2=window.open(URL,"cartpop",'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,height=560,width=650,left=0,top=0,screenX =0,screenY=0');
}
// End -->

<!-- Begin pop up for Download dock
function popUpDownload(url){
	myFinalHeight = 300 ;
	jQuery.facebox('<iframe src=\''+ url + '\' frameborder="0" height=\''+ myFinalHeight + '\' scrolling="auto" width="500"></iframe>')
}
// End -->


<!-- Begin pop up for Quote for get a quote
var win6= null;
function popUpQuote(url){
	
	//win6=window.open(URL,'Quote',"toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,height=440,width=500,left=0,top=0,screenX =0,screenY=0");
	var myHeight = 440;
	var myHeight2 = Math.round(getPageHeight() *.7);
	myFinalHeight = (myHeight2 > myHeight) ? myHeight2 : myHeight ;
	
	jQuery.facebox('<iframe src=\''+ url + '\' frameborder="0" height=\''+ myFinalHeight + '\' scrolling="auto" width="500"></iframe>')
}
// End -->

<!-- For now this pops up the blog but can pop up any other site we want to show up
var win7= null;
function popUpExternalURL(url){
	
	var myHeight = 440;
	var myWidth = 800;
	var myHeight2 = Math.round(getPageHeight() *.85);
	myFinalHeight = (myHeight2 > myHeight) ? myHeight2 : myHeight ;
	myWidth = (Math.round(getPageWidth() *.9) > 1024) ? 1040 : Math.round(getPageWidth() *.9) ;
	
	jQuery.facebox('<iframe src=\''+ url + '\' frameborder="0" height=\''+ myFinalHeight + '\' scrolling="auto" width=\''+ myWidth + '\'></iframe>');
}
// End -->

<!-- Begin pop up window
var win= null;
function OpenNewWindow(mypage,w,h,myname){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=no'
win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
// end script here -->

function windowSize() {
	var myHeight = 0;
	if( typeof( window.innerHeight ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	} else if( document.documentElement && (document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientHeight ) ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	//only want it to be 90% of possible visible height - 0r min of 506
	myHeight = myHeight *.7;
	//window.alert( 'Height = ' + myHeight );
	return(Math.round(myHeight));
}

