﻿function dothesubmitenter(evt,buttonToClick)
	{
		if(window.event) {
		// for IE, e.keyCode or window.event.keyCode can be used
		key = evt.keyCode; 
		}
		else{
			// netscape
			key = buttonToClick.which; 
		}
		
		if(key==13)
		{
			if(window.event)
			{
				window.event.keyCode.returnValue=false;
				window.event.keyCode=true;
			}
			else
			{
				return false;
			}
			
			document.getElementById(buttonToClick).click();
			return false;
		}
		return true;
	}
	
	function frmonblur()
		{
			if ((document.getElementById('TxtSearch').value == "كلمة البحث" ) || (document.getElementById('TxtSearch').value == ""))
				{
					document.getElementById('TxtSearch').value = "كلمة البحث";
				}
				else
				{
				//alert ("else");
				}
		
		}
			
	
	function DoSearch()
		{
		//alert(ValidateSearch());
				if(ValidateSearch())
				{
					
					document.location.href='/Search/?SearchKeyword='+ document.getElementById('TxtSearch').value;
				}
		
		}



	function ValidateSearch(){
	//alert('search start');
		if((document.getElementById("TxtSearch").value.length < 1)||(document.getElementById("TxtSearch").value=='كلمة البحث'))
		{
			alert('من فضلك أدخل كلمة البحث');
			document.getElementById("TxtSearch").focus();
			return false;
		}
		if (document.getElementById("TxtSearch").value.length < 3)
		{
			alert('من فضلك أدخل كلمة بحث لا تقل عن 3 حروف');
			document.getElementById("TxtSearch").focus();
			return false;
		}

		return true;
	}
	

//document.onselectstart=Avoid;
function Avoid()
{
//alert('no');
	return false;
}

function windowLoaded(evt) {
    // prevent IE text selection while dragging!!!
    // Little-known trick!
    document.body.ondrag = function () { return false; };
    document.body.onselectstart = function () { return false; };
}



//document.onselectstart=CheckSelection

function CheckSelection()
{
//alert(event.srcElement.type);
	if((event.srcElement.type=='text')||(event.srcElement.type=='textarea')||(event.srcElement.type=='password'))
	{
		return true;
	}
	else
	{
		return false;
	}
}
















