// JavaScript Document
function defaultMediaSet()
{
	document.getElementById('hp_v_c').style.display = "";
	document.getElementById('hp_i_c').style.display = "none";
	document.getElementById('hp_i_c').style.background = '#fff';
	document.getElementById('hp_v_c').style.background = '#000';
}
function mediaHP(itemToFocus,contents)
{
	var item1 = document.getElementById('hp_v');
	var item2 = document.getElementById('hp_i');
	
	document.getElementById('hp_v_c').style.display = "none";
	document.getElementById('hp_i_c').style.display = "none";
	
	item1.style.background = '#000 url(images/aaa.jpg)';
	item2.style.background = "#000 url(images/aaa.jpg)";
	
	var itemOnSpot = document.getElementById(itemToFocus);
	itemOnSpot.style.background = "#fff url(images/menu_abg_over.png)";
	
	var contentOnSpot = document.getElementById(contents);
	contentOnSpot.style.display = "";
}
function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) { field.value = field.value.substring(0, maxlimit); }
	else { document.getElementById(cntfield).innerHTML = maxlimit - field.value.length; }
}
function ShowMediaFile(FileID)
{
	var xmlhttp;
	var file_div = document.getElementById("media_album_insider");
	if (window.XMLHttpRequest) {
		xmlhttp=new XMLHttpRequest();
	}
	else {
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	var getdate = new Date();  //Used to prevent caching during ajax call
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==3 || xmlhttp.readyState==2 || xmlhttp.readyState==1) {
			file_div.innerHTML = "<center><div class='loader_bg'><br /><br /><br /><br /><img src='images/loading.gif' style='border:none; margin:0px;' /></div></center>";
		}
		else if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			file_div.innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","_showMediaFile.php?FileID="+FileID+"",true);
	xmlhttp.send();
}

function TxtBoxOn(txtID, msg) { var txtVal = txtID.value; if(txtVal == msg) { txtID.value = ''; } else { txtID.value = txtVal; txtID.select(); } txtID.style.color = '#303030'; txtID.style.fontStyle='normal'; } function TxtBoxOut(txtID, msg) { var txtVal = txtID.value; if(txtVal == msg) { txtID.value = msg; } else if(txtVal == '') { txtID.style.color = '#a9a9a9'; txtID.style.fontStyle='italic'; txtID.value = msg; } else { txtID.value = txtVal; } } function validateCommentForm() { do { var Field_0; Field_0=document.getElementById('VName').value; if((Field_0.length==0) || (Field_0.charAt(0)==' ') || (Field_0=='')) { alert('من فضلك ادخل اسمك الشخصي'); document.getElementById('VName').value=''; document.getElementById('VName').focus(); document.getElementById('VName_label').style.color='#F00'; return false; break; }	else { document.getElementById('VName_label').style.color='#000000'; }var Field_1; Field_1=document.getElementById('VEmail').value; if((Field_1.length==0) || (Field_1.charAt(0)==' ') || (Field_1=='')) { alert('من فضلك ادخل البريد الإلكتروني'); document.getElementById('VEmail').value=''; document.getElementById('VEmail').focus(); document.getElementById('VEmail_label').style.color='#F00'; return false; break; }	else { document.getElementById('VEmail_label').style.color='#000000'; }var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/; if(!document.getElementById('VEmail').value.match(emailRegex)) { document.getElementById('VEmail').focus(); window.alert('من فضلك بريدك الإلكتروني بصورة صحيحة'); return false; } var Field_2; Field_2=document.getElementById('CmntTitle').value; if((Field_2.length==0) || (Field_2.charAt(0)==' ') || (Field_2=='')) { alert('من فضلك ادخل عنوان التعليق'); document.getElementById('CmntTitle').value=''; document.getElementById('CmntTitle').focus(); document.getElementById('CmntTitle_label').style.color='#F00'; return false; break; } else { document.getElementById('CmntTitle_label').style.color='#000000'; }var Field_3; Field_3=document.getElementById('CmntBody').value; if((Field_3.length==0) || (Field_3.charAt(0)==' ') || (Field_3=='')) { alert('من فضلك ادخل محتوى التعليق'); document.getElementById('CmntBody').value=''; document.getElementById('CmntBody').focus(); document.getElementById('CmntBody_label').style.color='#F00'; return false; break; } else { document.getElementById('CmntBody_label').style.color='#000000'; } } while(0) }
function Prnt(ArticleID) {
	//addFor: to specify do you want to add the new client to the directory only or to an event (will be added to the directory and the event)
	window.open("print.php?ID="+ArticleID+"", "_blank" , "directories = no, fullscreen = no, height = 700, width = 800, location = no, menubar = no, resizable = no, status=no, titlebar = no, toolbar = no, scrollbars=yes, yahootoolbar = no");
}
