document.oncontextmenu = new Function("return false");
addLoadEvent(disablerightclick);
addLoadEvent(disableSelection);


document.ondragstart = function() 
{ 
	return false; 
}
document.onmousedown = function(e) {  
  
	if (e && e.preventDefault) {  
	var t = e.target;  
	var nName = t.nodeName.toLowerCase();  
		if (nName == "img") {  
			e.preventDefault();  
			return false;  
		}  
		while (t) {  
			if (t.nodeName == "a") {  
			e.preventDefault();  
			return false;  
		}  
		t = t.parentNode;  
		}  
	}  
}
//----------------------------- Disable right click -------------------------------
var clickmessage="All rights reserved - morvital.net";
function disableclick(e) {
if (document.all) {
	if (event.button==2||event.button==3) {
			alert(clickmessage);
			return false;
	}
}
else if (document.layers) {
	if (e.which == 3) {
		alert(clickmessage);
		return false;
	}
}
else if (document.getElementById){
		if (e.which == 3) {
			e.preventDefault();
      		e.stopPropagation();
			alert(clickmessage);
			return false;
		}
	}
}
function associateimages(){
	for(i=0;i<document.images.length;i++)
		document.images[i].onmousedown=disableclick;
}
function disablerightclick()
{
	if (document.all)
		document.onmousedown=disableclick
	else if (document.getElementById)
		document.onmouseup=disableclick
	else if (document.layers)
		associateimages()
}
//----------------------------- Disable right click End -------------------------------

//----------------------------- No Select ---------------------------------------------
function disableSelection() { 
	target = document.body;
	if (typeof target.onselectstart!="undefined") //IE route 
		target.onselectstart=function(){return false} 
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route 
		target.style.MozUserSelect="none" 
	else //All other route (ie: Opera) 
		target.onmousedown=function(){return false} //How to disable
		target.style.cursor = "default" 
} 
//----------------------------- No Select End -----------------------------------------
function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} 
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
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 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 OpenWindow(Src) {
	var w = 400;
	var h = 360;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = "top=" + wint + ",left=" + winl + ",resizable=no,scrollbars=no" + ",width="+ w + ",height="+ h;
	winMovie = window.open(Src, "popupMitchamEmail", winprops)
	if (parseInt(navigator.appVersion) >= 4) { winMovie.window.focus(); }
}



