/*************************************************************
Apio, Inc. global javascript

Written by Vitamin
http://www.vitamininc.net/
*************************************************************/

/*************************************************************
Product search field functions
*************************************************************/

function clearField(whichField, textToMatch) {
	if(whichField.value == textToMatch) { whichField.value = ""; }
}

function fillField(whichField, text) {
	if(whichField.value == "") { whichField.value = text; }
}

/*************************************************************
Popup Window
*************************************************************/

function openWin(url) {
	// get the height/width of the user's screen
	var screenHeight = screen.availHeight;
	var screenWidth = screen.availWidth;
	
	// set the desired height/width of the new window
	var winHeight = 400;
	var winWidth = 440;
	
	// calculate the exact center
	var winY = Math.round(((screenHeight/2)-(winHeight/2))-50);
	var winX = Math.round((screenWidth/2)-(winWidth/2));
		
	// open the window at the correct position
	//var theWin = window.open(url, "whatsthis_win", "width="+winWidth+",height="+winHeight+",top="+winY+",left="+winX+",scrollbars=true");
	var theWin = window.open(url, "whatsthis_win", width="450", height="500", top="+winY+",left="+winX+", address="false");
	
	// bring the window to the front
	theWin.focus();
}
