// JavaScript Document

/////////////verify code/////////
function verify(){
		var dis=document.getElementById("notmatched");
		var code1=document.getElementById("code1");
		var code2=document.getElementById("code2");
		if(code1.value!=code2.value){
		dis.innerHTML="غير متطابق";
		code1.style.background="#FFD2E9";
		return false;
		}else{
		dis.innerHTML="";
		code1.style.background="#AEFFD7";
		}
}

/////////////////focus
function setfocus( idfocus){
		
		for (var i=1;i<=7;i++){
		var obj=document.getElementById("reg"+i);
		if(obj.id==idfocus){
		
		obj.style.background="#E9EEF3";
		}else{
	obj.style.background="#FFFFFF";
		//document.getElementById(idfocus).className = "myC";
		}
		}
}
////////////////////////////////flag
function flage_show(){
		var img=document.getElementById("flag");
		var country=document.getElementById("country");
		
		var currentop = country.options[country.selectedIndex];
		img.src="images/flag/"+currentop.value.toLowerCase()+".gif";

}

/////////////display icon image
function icon_display(){
		var iconvalue=document.getElementById("icon");
		var place=document.getElementById("iconhere");
		place.innerHTML="<img src='images/icon/"+iconvalue.options[iconvalue.selectedIndex].value + "' height='25'/>";
}
////////////////// open new window
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',0'
win = window.open(mypage,myname,settings)
}
////////////////// open new window
var map = null;
function MapWindow(mypage,myname,w,h,scroll){
LeftPositionmap = (screen.width) ? (screen.width-w)/2 : 0;
TopPositionmap = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPositionmap+',location=1'+',left='+LeftPositionmap+',scrollbars='+scroll+',0'
map = window.open(mypage,myname,settings)
}
//// read cookie()
function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") {
 return false; 
 }else{
	 return true;
	 }
}

////////////////////////////////// chating message//
function chatmsg(touser_id){
	if(ReadCookie("isonlineid")){
		
	var chaturl="chat/chat.php?tid="+touser_id;
	NewWindow(chaturl,'chat','610','420','no');
			//	window..open('msnim:chat?contact=omda_1981@yahoo.com');
		//}else{
		//	alert("عفوا يجب التسجيل في الموقع أولا");
			//window.document("<a onclick='window.open(this.href);' href='msnim:chat?contact=omda_1981@yahoo.com' target=blank'> تحدث معي </a>");
			}
	
	}/////

function highlight(box, obj)
{
     var color1 = '#E3E9F1';
     var color2 = '#FFFFFF';

     document.getElementById(obj).style.background = (box.checked ? color1 : color2);
}

////////////////////////////////
function chk_unchk(theform,chkboxid){
var f=document.forms[theform];
var chk=document.getElementById(chkboxid);
if(chk.checked){
for(var i=0;i<f.elements.length;i++){
var e=f.elements[i];
if(e.type=="checkbox"){
e.checked=true;
}
}
}else{
for(var i=0;i<f.elements.length;i++){
var e=f.elements[i];
if(e.type=="checkbox"){
e.checked=false;
}
}
}
}
//////////////////