var hit = "false"

function xClear(theField){ //Copyright(C) E. Genochio 2001 - clears the field - but only once!
	if (hit == "false"){
		theField.value = ""
		hit = "true"
		}
}

function displayWindow(theURL,winName,width,height,features,center) { //v3.1
// Made by Eddie Traversa modified from Macromedia Code
// http://nirvana.media3.net/
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
		if (center){
	    	var window_top =  (screen.height-window_height)/2;
    		var window_left = (screen.width-window_width)/2;
			}
		else {
	    	var window_top = 0; 
    		var window_left = 0;
			}		
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
    newWindow.focus();
}

function EG_GoToURL(base, qs, altbase, theObj){

if(qs == ""){return false}
else{
	if (qs == "All" || qs == "Classic" || qs == "Contemporary") //if the qs value is one of these "list" items, go straight there
		{ 	theURL = altbase + "?styles=" + qs; 
			EG_ActuallyGoThere(theURL)
		}
	else 
		{ theURL = base + "?p=" + qs;
			GoThere = confirm('View ' + unescape(qs) + ' Pattern Cutlery?') // unescape URLDecodes the querystring
		
			if (GoThere){EG_ActuallyGoThere(theURL)}
			if (! GoThere){ theObj.selectedIndex=0;theObj.blur()}
		}	

	
	}
}

function EG_ActuallyGoThere(where){
document.location = where;
return true;
}	

function EG_goToPattern(theQS){
	document.location = '/cutlery2/pages/cutlery_list.asp' + theQS
	}
	
function EG_setStatus(str) { 
  status=str;
  document.MM_returnValue = true;
}

function EG_ClearStatus(){
	parent.status = "Welcome to Direct Cutlery"
	document.MM_returnValue = true;
	}
	
function closeIt(){// closes the window and returns focus to the opener
	parent.close();
	parent.opener.focus();
}

function showAccessoryCloseUp(theItemRef) {// launches new window for to display close-up picture of a given accessory
    var window_width = 750;
    var window_height = 500;
    var newfeatures= 'menubar=yes,scrollbars=yes'
	    	var window_top =  (screen.height-window_height)/2; //centre vertically
    		var window_left = (screen.width-window_width)/2; //centre horizontally
			
    newWindow=window.open('/cutlery2/accessories_detailed_picture.asp?item=' + theItemRef,'accessoryPop','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
    newWindow.focus();
	}
	
function lhsMenuHandler2(item){ // actions the "products" drop-down menu
	if(item=='cutlery_contemporary') // go to contemporary cutlery page
		{document.location = '/cutlery2/complete_cutlery_list.asp?styles=Contemporary';return false}
	if(item=='cutlery_classic') // go to classic cutlery page
		{document.location = '/cutlery2/complete_cutlery_list.asp?styles=Classic';return false} 
	if(item=='cutlery_all') // go to all cutlery page
		{document.location = '/cutlery2/complete_cutlery_list.asp?styles=All';return false}
	document.location = ('/cutlery2/tableware_accessories.asp?item=' + item) 
	
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


/*
We want to:
1. Keep the menubar at the top
2. Hide the search panel until asked, and then keep it centered until closed.
*/

function maximise(what) { // maximise layer
 //     alert(what)
     var height, width;
if (document.all){
   height = document.body.offsetHeight, width = document.body.offsetWidth;
   what.style.height = 200;
   what.style.width = 250;
   what.style.left = (width/2)-125;
   what.style.top = (height/2)-100;
   what.style.overflow = 'auto';
   what.style.visibility = 'visible'
  }
else if (document.layers){
height = window.innerHeight, width = window.innerWidth;
document.layers['abs'].visibility = 'hide';
   document.layers['abs'].height = 69;
   document.layers['abs'].width = 300;
   document.layers['abs'].left = 0;
   document.layers['abs'].top = 0;
}
centerLayer(what)
}






function topIt() { // keeps menubar on top
     var height, width;
if (document.all){
   height = document.body.offsetHeight, width = document.body.offsetWidth;
   abs.style.height = 69;
   abs.style.width = width - 17;
   abs.style.left = 0;
   abs.style.top = 0;
   abs.style.overflow = 'hidden';
   abs.style.visibility = 'visible';
   positionIt()
  }
else if (document.layers){
height = window.innerHeight, width = window.innerWidth;
document.layers['abs'].visibility = 'show';
document.layers['abs'].height = 320;
document.layers['abs'].width = 350;
document.layers['abs'].left = (width/2)-175;
document.layers['abs'].top = (height/2)-150;
   isMax = true
   centerLayer()
}
}

function centerLayer(){
   height = document.body.offsetHeight
     cutlery.style.top=document.body.scrollTop+(height/2)-75
   setTimeout("centerLayer()",50)
  }  

function hideLayer(what) { //  hides layer
if (document.all){
   what.style.visibility = 'hidden';
   }
else if (document.layers){
   document.layers[what].visibility = 'hide';
}
}

function positionIt(){
//if the user is using IE 4+
   if (document.all){
      abs.style.left= parseInt(document.body.scrollLeft)
      abs.style.top=document.body.scrollTop
}
   //else if the user is using NS 4
   else if (document.layers){
      document.abs.left= pageXOffset
      document.abs.top=pageYOffset
   }
setTimeout("positionIt()",200)
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}