// JavaScript Document

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function clearfield(){
if (document.getElementById('search').value.indexOf("...") > -1)
	document.getElementById('search').value = "";
}
function promptSearchfield(text){
if (document.getElementById('search').value == "")
	document.getElementById('search').value = text;
}

function clearElement(element){
    // If we've got ... in the box, clear it
    if (element.value.indexOf("...") > -1)
    	element.value = "";
    // We've no longer got the default value in this element
    $(element).removeClass("defaultItem");
}
function promptElement(element, text){
    // If the text's not set, put in the default value
    if ((element.value == "" || element.value == text) && ($(element).attr("type") != "password"))
    {
    	$(element).addClass("defaultItem");
        element.value = text;
    }
}

function checksearch(f){
if (document.getElementById('search').value.indexOf("...") > -1 || document.getElementById('search').value == "")
	{
	alert("You must enter a search word or phrase");
	return false;
	}
if (document.getElementById('search').value.length < 2)
	{
	alert("Your search word must be 2 or more characters");
	return false;
	}

return true;
}

var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);

function initPopupBox(){
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval('document.all.PopupBoxDiv.style');
	else if(ns)	adDiv=eval('document.layers["PopupBoxDiv"]');
	else if(w3)	adDiv=eval('document.getElementById("PopupBoxDiv").style');
	showPopupBox();
}
function initPopupBasket(){
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval('document.all.popupbasket.style');
	else if(ns)	adDiv=eval('document.layers["popupbasket"]');
	else if(w3)	adDiv=eval('document.getElementById("popupbasket").style');
    if (ie||w3)
        adDiv.visibility="visible";
    else
        adDiv.visibility ="show";
}
function closePopupBasket(){
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval('document.all.popupbasket.style');
	else if(ns)	adDiv=eval('document.layers["popupbasket"]');
	else if(w3)	adDiv=eval('document.getElementById("popupbasket").style');
	closePopupBox();
}
function showPopupBox(){
	var calunit=ns? "" : "px"
	if (ie){documentWidth  =truebody().offsetWidth/2+truebody().scrollLeft-20;
		documentHeight =truebody().offsetHeight/2+truebody().scrollTop-20;}	
	else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
		documentHeight=window.innerHeight/2+window.pageYOffset-20;} 
	else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
		documentHeight=self.innerHeight/2+window.pageYOffset-20;} 
		
	adDiv.left=documentWidth-50+calunit;adDiv.top =documentHeight+calunit;

    if (ie||w3)
        adDiv.visibility="visible";
    else
        adDiv.visibility ="show";
		
	setTimeout("closePopupBox()",2000);
}
function closePopupBox(){
if (ie||w3)
	adDiv.visibility="hidden";
else
	adDiv.visibility ="hide";
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function popup(url,name,w,h,s) { 
l = (screen.availWidth-10 - w) / 2; 
t = (screen.availHeight-20 - h) / 2;
var features;
if(s=="yes") {s = 1;} else {s = 0;} 
features = "width="+w+",height="+h+",left="+l+",top="+t; 
features += ",screenX="+l+",screenY="+t; 
features += ",scrollbars=yes,resizable=1,location=0"; 
features += ",menubar=0,toolbar=0,status="+s; 
window.open(url,name,features);
return false;
}
