// JavaScript Document
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="search_results.php?query="+query;
	document.search1.submit();
	return false;
}
function call_terms()
{
	window.open("http://www.gecanderson.co.uk/pdf/terms.html");
}
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 copyrighted to 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 createCookie(NameOfCookie, value, expirehours)
{
	if (typeof(expirehours) == "undefined") expirehours = 720;
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expirehours * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expirehours == null) ? "" : "; expires=" + ExpireDate.toGMTString()) + "; path=/;" ;
}
function readCookie(NameOfCookie)
{
	var cokie = document.cookie;
	var index = cokie.indexOf(NameOfCookie + "=");
	if (index == -1) return null;
	index = cokie.indexOf("=", index) + 1; // first character
	var endstr = cokie.indexOf(";", index);
	if (endstr == -1) endstr = cokie.length; // last character
	//alert(unescape(cokie.substring(index, endstr)));
	return unescape(cokie.substring(index, endstr));
}

/*function WelcomeNote()
{
   if(window.XMLHttpRequest) // Mozilla
   {
       objXMLHTTP = new XMLHttpRequest();
   }
   else if(window.ActiveXObject) // IE
   {
       objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
   }
   
   url="welcome_note.php";      
   objXMLHTTP.open("GET",url,false);
   objXMLHTTP.send("");
   data = objXMLHTTP.responseText;
         
   if(data !=0)       
   { 
     document.getElementById("viewcart_sitemap_id").innerHTML='<table border="0px" width="100%"><tr><td width="50%"><a href="shopping_cart.php" class="whtfont"><img src="../images/btn_view.gif" alt="" border="0"></a></td><td width="50%"><a href="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="sitemap.php" class="whtfont"><img src="../images/btn_sitemap.gif"  border="0" alt="" /></a></td></tr></table>';
   }
}*/

function eraseCookie(NameOfCookie)
{
	createCookie(NameOfCookie,"",-1);
}

//Google Analytics
/*_uacct = "UA-2651079-1";
urchinTracker();*/

