// JavaScript Document
function onFocusSearch(searchField)
{
	if(searchField.value == 'enter keyword')
	{
		searchField.value='';
	}
}

function onChangeSearch(searchField)
{
	if(searchField.value == '')
	{ 
		searchField.value = 'enter keyword';
	}
}

function NewWindow(mypage, myname, w, h, scroll, resizable, status) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resizable+',status='+status+'';
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// tell a friend
function emailThisPage(intSiteID)
{
	NewWindow('./emailThisPage.php?id='+intSiteID, 'EmailThisPage', 600, 600, 1, 0);
	//alert(window.location);
}

function printPage()
{
	var txtQueryString = window.location.search.substring(1);
	var txtPrint = (txtQueryString=="")?'?print=1':'&print=1';
	NewWindow(window.location + txtPrint, 'PrintPage', 760, 600, 1, 1, 0);
}

// send email
function sendEmail(intSiteID)
{
	NewWindow('/sendemail.php?id=' + intSiteID, 'SendEmail', 600, 600, 1, 1, 0);
}

// send enquiry
function sendEnquiry(txtProductCode)
{
	NewWindow('./enquiry.php?txtProductCode=' + txtProductCode, 'makeEnquiry', 600, 700, 1, 1, 0);
}

// send link
function sendLink(txtProductCode)
{
	NewWindow('./link.php?txtProductCode=' + txtProductCode, 'sendLink', 600, 700, 1, 1, 0);
}

//vip flash new window
function goNewWin() {

var NewWinHeight=screen.width;
var NewWinWidth=screen.height;

var NewWinPutX=0;
var NewWinPutY=0;

TheNewWin =window.open("./flash/virtualdesign.htm",'VIP Packaging','fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); 

TheNewWin.resizeTo(NewWinHeight,NewWinWidth);
TheNewWin.moveTo(NewWinPutX,NewWinPutY);

}

function expand(expandOrCollapseID, secondLvlDropdownID)
{
	document.getElementById(secondLvlDropdownID).style.display = 'block';
	document.getElementById(expandOrCollapseID).innerHTML = '<a href="javascript:collapse(' + "'" + expandOrCollapseID + "'" + ', ' +  "'" + secondLvlDropdownID + "'" + ')">-</a>';
}

function collapse(expandOrCollapseID, secondLvlDropdownID)
{
	document.getElementById(secondLvlDropdownID).style.display = 'none';
	document.getElementById(expandOrCollapseID).innerHTML = '<a href="javascript:expand(' + "'" + expandOrCollapseID + "'" + ', ' + "'" + secondLvlDropdownID + "'" + ')">+</a>';	
}