// JavaScript Document


function popwpages(val){

window.open("print_wpages.php?ID="+val,'Result',"width=680,height=520,top=120,left=200,scrollbars=yes");

}
function pop2(val){

window.open("print_makalat.php?ID="+val,'Result',"width=680,height=520,top=120,left=200,scrollbars=yes");

}
function popmak(val){

window.open("print_mak.php?ID="+val,'Result',"width=680,height=520,top=120,left=200,scrollbars=yes");

}
function popdalel(val){

window.open("print_dalel.php?ID="+val,'Result',"width=680,height=520,top=120,left=200,scrollbars=yes");

}
function popabout(val){

window.open("print_about.php?ID="+val,'Result',"width=680,height=520,top=120,left=200,scrollbars=yes");

}
function popprice(val){

window.open("print_price.php?ID="+val,'Result',"width=680,height=520,top=120,left=200,scrollbars=yes");

}

function pop3(val){

window.open("s2f.php",'Result',"width=450,height=300,top=120,left=100,scrollbars=yes");

}

function pop4(val){

window.open("comment.php?type=articles&ids="+val,'Result',"width=450,height=300,top=120,left=200,scrollbars=yes");

}

function pop5(val){
window.open("new_comments.php?do_comments=add&the_type=<?=$the_type?>&ID_comments=<?=$ID_comments?>"+val,'Result',"width=450,height=220,top=120,left=200,scrollbars=yes");
}


/***********************************************

* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)

* This notice must stay intact for legal use.

* Visit http://www.dynamicdrive.com/ for full source code

***********************************************/



function getposOffset(overlay, offsettype){

var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;

var parentEl=overlay.offsetParent;

while (parentEl!=null){

totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;

parentEl=parentEl.offsetParent;

}

return totaloffset;

}



function overlay(curobj, subobjstr, opt_position){

if (document.getElementById){

var subobj=document.getElementById(subobjstr)

subobj.style.display=(subobj.style.display!="block")? "block" : "none"

var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 

var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)

subobj.style.left=xpos+"px"

subobj.style.top=ypos+"px"

return false

}

else

return true

}



function overlayclose(subobj){

document.getElementById(subobj).style.display="none"

}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=380,height=200,left = 250,top = 125');");
}
function send_form1(val){

window.location.href=('?do=search&word=<?=$word?>&limit='+val+'&pages=<?=$pages?>&ord=<?=$ord?>');

}

function send_form2(val){

window.location.href=('?do=search&word=<?=$word?>&limit=<?=$limit?>&pages='+val+'&ord=<?=$ord?>');

}

function send_form3(val){

window.location.href=('?do=search&word=<?=$word?>&limit=<?=$limit?>&pages=<?=$pages?>&ord='+val);

}
<!-- 
function nosingleQute()
    {if(event.keyCode ==  39 )
        {event.returnValue=false;}
    }	

function ValidateForm()
{
		var message="";
        // test the card holder's name length
        if(document.form.name.value.length == 0 || document.form.name.value.charAt(0).charCodeAt(0)==32)
		{
        	message=message+"إدخل الإسم\n";
        }
		 
		var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;
        if(!(regex.test(document.form.mail.value)))
		{           message=message+"إدخل البريد\n";        }
		 if(document.form.message.value.length == 0 || document.form.message.value.charAt(0).charCodeAt(0)==32)
		{
        	message=message+"إدخل نص الرسالة\n";
        }
		if(message.length>0)
		{//there is an error message
         	alert(message);
            return false;
        }
		else	{		document.form.submit();		}
}

function Valunumber()
{	if(event.keyCode <  48 || event.keyCode > 57 )
	  {
		window.alert("<?=$trans['plz_insert_number']?>");
		event.returnValue=false;
	  }
}
//-->
function rafiawin(external, height, width) {
    options = 'height=' + height + ',width=' + width + ',scrollbars=1,resizable=1,top=0,left=0';
window.open(external, 'rafia', options);
}
function dirt(X){
if (X==1){
document.getElementById("cc").direction="right";
document.getElementById("cc").start();
}
if(X==2){
document.getElementById("cc").stop();
}
if(X==3){
document.getElementById("cc").direction="left";
document.getElementById("cc").start();
}
}
      function replaceText(text){
	      while(text.lastIndexOf("&") > 0){
		      text = text.replace('&', '[i-Stats]');
	      }
	      return text;
      }
function pick(obj) {
	obj.filters.alpha.opacity=100;
	obj.filters.gray.enabled=false;
}
function unpick(obj) {
	obj.filters.alpha.opacity=80;
	obj.filters.gray.enabled=true;
}
    function lightup(imageobject, opacity){
    if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
    imageobject.style.MozOpacity=opacity/100
    else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4)
    imageobject.filters.alpha.opacity=opacity
}
	function poll_(form){
	var X = form.ID.value;
	for(i=0;i<form.poll.length;i++){
	if(form.poll[i].checked){
	var Y = form.poll[i].value;
	}
	}
	//alert(Y);
	showHint(X ,Y);
	}
function on_click(idtag){
if(document.getElementById(idtag).style.display=='none'){
document.getElementById(idtag).style.display='';
}else{
document.getElementById(idtag).style.display='none';
}
}


function chek_form(){
try {
var Msg='';
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
var returnval=emailfilter.test(user.email.value);
if(user.name.value==''){
Msg=Msg+"من فضلك أدخل الإسم \n";
}
if(user.country.value==''){
Msg=Msg+"من فضلك إختار البلد \n";
}

if (returnval==false){
Msg=Msg+"من فضلك أدخل البريد \n";
}
if (user.phone.value==""){
Msg=Msg+"من فضلك أدخل الهاتف \n";
}

if(Msg!=''){
alert(Msg);
return false;
}else{
return true;
}
}
 catch (e) {
        alert(e.message);
    }

}
// JavaScript Document
  function get_From_Server(){

	
		try{ Answer = new XMLHttpRequest();
			}catch(error){
		try{
			Answer = new ActiveXObject("Microsoft.XMLHTTP");
			}  catch(error){ Answer = null; return false;
							}
						  }
		
		Answer.onreadystatechange = change_when_have_info;
		mail = encodeURIComponent(document.user.email.value);
		Answer.open("POST", "check_mail.php?mail="+mail,true);
//		Answer.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		Answer.setRequestHeader('Content-Type', 'text/html; charset:windows-1256');
		Answer.send(null);
		  
					    	
							}
	
	function change_when_have_info(){
		if (Answer.readyState == 4){
			if(Answer.status == 200){
					document.getElementById('ChangeHere').innerHTML = Answer.responseText;
					//alert(Answer.responseText);
			}
		}
	}
	
	////////////////
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function chk(form){
var returnval1=emailfilter.test(form.email.value)
if (returnval1==false){
alert("إدخل بريد صحيح")
form.email.select();
return false;
}
var returnval2=emailfilter.test(form.femail.value)
if (returnval2==false){
alert("إدخل بريد صحيح")
form.femail.select();
return false;
}
if(form.name.value==''){
alert("إدخل الإسم");
form.name.focus();
return false;
}
if(form.fname.value==''){
alert("إدخل إسم صديقك");
form.fname.focus();
return false;
}
if(form.msg.value==''){
alert("إدخل نص الرسالة");
form.msg.focus();
return false;
}
}
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength);
document.getElementById("count").innerHTML='';
document.getElementById("count").innerHTML=mlength-obj.value.length;
}



