// JavaScript Document

/*function check()
{
	if(document.frmsearch.search1.value=="")
	{
		alert("Please enter Search");
		document.frmsearch.search1.focus();
		return false;
	}
	document.frmsearch.action="search_staticpage.php";
	document.frmsearch.submit();
}*/
function openwin(url)
{
    window.open(url,"URL","location=no,directories=no,toolbars=no,status=no,scrollbars=yes,resizable=yes,width=700,height=700");
    return false;
}
function call_terms()
{
  	//window.open("../pdf/terms.pdf");
  		window.open("../pdf/terms.html");
}
function check()
{
  	if(document.search1.search.value=="")
	  {
	   	alert("Please enter value for Search");
	   	document.search1.search.focus();
		return false;
	  }
	  var query=document.search1.search.value;
	  document.search1.action="http://gecanderson.websitters.co.uk/scripts/search_results.php?query="+query;
	  document.search1.submit();
	  return false;
}
var specialcase = ((navigator.userAgent.indexOf('Mac') != -1) || document.all)
var flag = 0;
//var msg = 'This image is protected by copyright.\nWe request you not to copy it.';
//var msg = 'The images are copyright © GEC Anderson.';
var x,y,x1,y1,copyAttempt;

function init()
{
	if (!(document.getElementById || document.all || document.layers)) return;
	if (specialcase && document.layers)
	{
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = special;
	}
	for (i=0;i<document.images.length;i++)
	{
		document.images[i].onmousedown = checkIt;
		document.images[i].onmouseup = function() {return false};
		if (specialcase)
		{
			document.images[i].onmousemove = special;
			document.images[i].onclick = clearIt;
		}
	}
}
function checkIt(e)
{
	copyAttempt = 0;
	if (window.Event)
	{
		x = e.screenX;
		y = e.screenY;
		theButt = (e.which == 3);
	}
	else
	{
		x = window.event.clientX;
		y = window.event.clientY;
		theButt = (window.event.button == 2);
	}
	if (theButt)
	{
		copyAttempt = 1;
		flag = 0;
		var msg = document.getElementById("alert_id").value;
		alert(msg);
		return false; // NN4 only
	}
	if (specialcase) flag = 1;
	return false;
}
function special(e)
{
	theObj = '';
	if (window.Event)
	{
		x1 = e.screenX;
		y1 = e.screenY;
		if (e.target.parentNode) theObj = e.target.parentNode.tagName;
	}
	else
	{
		x1 = window.event.clientX;
		y1 = window.event.clientY;
		theObj = window.event.srcElement.parentElement.tagName;
	}
	var isLink = (theObj == 'A');
	if (flag && (!isLink || ((Math.abs(x-x1) > 10) || (Math.abs(y-y1) > 10))))
	{
		copyAttempt = 1;
		flag = 0;
		var msg = document.getElementById("alert_id").value;
		alert(msg);
		return false;
	}
}
function clearIt()
{
	flag = 0;
	if (copyAttempt)
	{
		copyAttempt = 0;
		return false;
	}
}
/*function View_Cart_Fun()
{
    //document.getElementById("view_cart_id").style.display="";
    if(window.XMLHttpRequest) // Mozilla
    {
       objXMLHTTP = new XMLHttpRequest();
    }
    else if(window.ActiveXObject) // IE
    {
       objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }  
    url="../../../../scripts/view_cart.php";      
    objXMLHTTP.open("GET",url,false);
    objXMLHTTP.send("");
    data =objXMLHTTP.responseText;    
    if(data==1)
    {
       document.getElementById("view_cart_img").style.display='';
       document.getElementById("view_cart_text").style.display='';
    }          
}*/
function WelcomeNote()
{
   if(window.XMLHttpRequest) // Mozilla
   {
       objXMLHTTP = new XMLHttpRequest();
   }
   else if(window.ActiveXObject) // IE
   {
       objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
   }
   url="../scripts/welcome_note.php";      
   objXMLHTTP.open("GET",url,false);
   objXMLHTTP.send("");
   data = objXMLHTTP.responseText;      
   if(data !=0)
   {
     document.getElementById("name_id").innerHTML=data;
     document.getElementById("logout_id").innerHTML="<a href='../scripts/signout.php' class='whitlink'>Sign out</a>";     
     document.getElementById("viewcart_sitemap_id").innerHTML='<table border="0px" width="100%"><tr><td width="50%"><a href="../scripts/shopping_cart.php" class="whtfont"><img src="../images/btn_view.gif" alt="" border="0"></a></td><td width="50%"><a href="../scripts/sitemap.php" class="whtfont"><img src="../images/btn_sitemap.gif"  border="0" alt="" /></a></td></tr></table>';
   }
   else
   {
     document.getElementById("viewcart_sitemap_id").innerHTML='<table border="0px" width="100%"><tr><td width="50%">&nbsp;</td><td width="50%"><a href="../scripts/sitemap.php" class="whtfont"><img src="../images/btn_sitemap.gif"  border="0" alt="" /></a></td></tr></table>';
   }
}

//Google Analytics
/*_uacct = "UA-2651079-1";
urchinTracker();*/
function clickIE()
{
  if (document.all)
  {(message);return false;}
}
function clickNS(e) 
{
if
(document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else
{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

