// JavaScript Document
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_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_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}

function fill(combo, name, src)
{
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4)
		{
			if (xmlhttp.status != 200)
			{
				alert("שגיאה!");
				return;
			}
			var doc = new ActiveXObject("Microsoft.XMLDOM");
			doc.async = false;
			doc.loadXML(xmlhttp.responseText);
			var nodes = doc.selectNodes("xml/rs:data/z:row");
			combo.length = 1;
			for (i=0; i < nodes.length; i++)
			{
				var opt = document.createElement("OPTION");
				opt.value = nodes[i].getAttribute("ID");
				opt.text = nodes[i].getAttribute("Name");
				combo.add(opt);
			}
			xmlhttp = null;
			doc = null;
		}
	}
	xmlhttp.open("GET", "getxml.asp?" + name + "=" + src.value, true);
//	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send();
}

function getDeliveryPrice( id )
{ 
 var myAjax = new Ajax.Request(
   'getdeliveryprice.asp?DeliveryID='+id,
   {
	method: 'get', 
	onComplete: function(response)
	{ 
		retValue=response.responseText;
		//alert(retValue);
	 	document.getElementById('TotalPrice').innerHTML = parseInt(document.cartform.Sum.value) + parseInt(retValue);
		document.cartform.Delivery.value = retValue;
	}
	
   }
);
}

function overData()
{
	var obj = window.event.srcElement;
	if (obj.tagName == "TD")
	{
		if (obj.parentElement.className.indexOf("click") < 0)
			obj.parentElement.className += " over";
	}
	else if (obj.tagName == "TH")
	{
		obj.className = "over";
	}
}

function outData()
{
	var obj = window.event.srcElement;
	if (obj.tagName == "TD")
	{
		if (obj.parentElement.className.indexOf("over") > 0)
			obj.parentElement.className = obj.parentElement.className.replace(" over", "");
	}
	else if (obj.tagName == "TH")
	{
		obj.className = "";
	}
}


function showHide(id)
{
	oDiv = document.getElementById(id);
	if (oDiv)
	{
		if (oDiv.style.display == "none")
		{
			oDiv.style.display = "inline";
		}
		else
		{
			oDiv.style.display = "none";
		}
	}
}

function sortData(strURL, strSort)
{
	var obj = window.event.srcElement;
	if (obj.tagName == "TH")
	{
		var ID = obj.id;
		if (ID)
		{
			strURL += "&Sort=" + ID;
			if (strSort == ID)
			{
				strURL += " DESC"
			}
			window.location.replace(strURL);
		}
	}
}

function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function menuclick(id)
{
	div = document.getElementById("div" + id);
	img = document.getElementById("p" + id);
	/*
	div.style.display = "block";
	if (lastmenuclickid > 0) {
		div = document.getElementById("div" + lastmenuclickid);
		div.style.display = "none";
	}
	lastmenuclickid = id;
	*/
	if (div.style.display != "none")
		div.style.display = "none";
		//alert(img);
		//img.style.display = "none";
	else
		div.style.display = "inline";
		//img.style.display = "block";
	
}

function searchProduct()
{
	if (searchForm.Search.value != "")
		searchForm.submit();
	else
		alert("יש לרשום מלת חיפוש");
}

function openproduct(id)
{
	var args = "left=300, top=200, width=450, height=450, status=no, toolbar=no, menubar=no, scrollbars=yes, location=no";
	window.open("showproduct.asp?ProductID=" + id, "", args);
}
<!--
 
var message="! XPRICE כל הזכויות שמורות לאתר";
///////////////////////////////////
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")
// -->
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
/***********************************************
* Disable select-text script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
* Modified here to exclude form tags properly and cross browser by jscheuer1
***********************************************/

//form tags to omit:
var omitformtags=["input", "textarea", "select"]

function disableselect(e){
for (i = 0; i < omitformtags.length; i++)
if (omitformtags[i]==(e.target.tagName.toLowerCase()))
return;
return false
}

function reEnable(){
return true
}

function noSelect(){
	if (typeof document.onselectstart!="undefined"){
		document.onselectstart=new Function ("return false")
		if (document.getElementsByTagName){
		tags=document.getElementsByTagName('*')
		for (j = 0; j < tags.length; j++){
			for (i = 0; i < omitformtags.length; i++)
				if (tags[j].tagName.toLowerCase()==omitformtags[i]){
					tags[j].onselectstart=function(){
						document.onselectstart=new Function ('return true')
						}
						tags[j].onmouseup=function(){
						document.onselectstart=new Function ('return false')
					}
				}
			}
		}
	}
	else{
		document.onmousedown=disableselect
		document.onmouseup=reEnable
	}
}

//window.onload=noSelect;
