// JavaScript Document
//<script language="javascript">
var openWin=0;

function openWindow(name,image){	
	for (var i =1; i<image.length; i++){
		image=image.replace ('&','||');
	}
	var displayPage = ('http://www.thpcollections.com/global/displayImage.php?name='+name+ '&image=http://www.thpcollections.com/'+image);

	var pageImage= new Image();
		pageImage.src = 'http://www.thpcollections.com/'+image;
	  //alert (pageImage.height);
    var windowHeight=(pageImage.height +50);
    if (windowHeight==0) windowHeight=(pageImage.height +50); //try again!
	if (windowHeight<600) windowHeight=600;
	  
   if(openWin){
     if(!openWin.closed) openWin.close();
   }	  

   openWin = window.open (displayPage,"popItem","toolbar=1,location=0,directories=0, status=0,menubar=1,scrollbars=0,resizable=0,width=615,height="+windowHeight+",left=20,top=50");
}


//call script with
//<a href="#" onclick="openWindow();"> button source </a>
/*
function variable_in_link(varible_value)
// function variable_in_link will assign the first variable
// passed to it as variable_value

{ 
new_win = window.open('http://www.'+varible_value+'.com','', 'width=640,height=400,left=10,top=10')
}
// -->
</script>

<body bgcolor="#FFFFFF">
<a href="javascript:variable_in_link('yahoo')">Yahoo</a> 
*/

function windowURL(URL) {
   if(openWin){
     if(!openWin.closed) openWin.close();
   }	
openWin = window.open (URL,"popItem","toolbar=0,location=0,directories=0, status=0,menubar=0,scrollbars=0,resizable=0,width=615,height=0,left=20,top=50");

//call this with: <a href=# onClick="javascript:popUrl('http://www.theURL');
}

function openPressWindow(name,image){	
	for (var i =1; i<image.length; i++){
		image=image.replace ('&','||');
	}
	var displayPage = ('http://www.thpcollections.com/global/displayImage.php?name='+name+ '&image=http://press.thehomeport.com/'+image);

	var pageImage= new Image();
		pageImage.src = 'http://press.thehomeport.com/'+image;
	    //alert (pageImage.height);
    var windowHeight=(pageImage.height +50);
    if (windowHeight==0) windowHeight=(pageImage.height +50); //try again!
	if (windowHeight<600) windowHeight=600;
	  
   if(openWin){
     if(!openWin.closed) openWin.close();
   }	  

   openWin = window.open (displayPage,"popItem","toolbar=1,location=0,directories=0, status=0,menubar=1,scrollbars=0,resizable=0,width=615,height="+windowHeight+",left=20,top=50");
}

function pressWindowURL(URL) {
   if(openWin){
     if(!openWin.closed) openWin.close();
   }	
openWin = window.open (URL,"popItem", "left=20,top=50");

}
