/*==================================================================================*\
|| ################################################################################ ||
|| # 			 Elbayt NetWork For Designing & Developing WebSites				  #	|| 
|| # ---------------------------------------------------------------------------- # ||
|| # All PHP code in this file is ©2009-2010 written by Elbayt NetWork developers.# ||
|| # This file may not be redistributed in whole or significant part.			  # ||
|| # ------------------------ THIS IS NOT FREE SOFTWARE ------------------------- # ||
|| # 			 http://www.elbayt.net   |   astm_desig@hotmail.com 			  # ||
|| ################################################################################ ||
\*==================================================================================*/
function ListFind(list, value){
  var i = 0;
  var delimiter = ',';
  var returnValue = -1;
  var _tempArray = new Array();
  if(ListFind.arguments.length == 3)
    delimiter = ListFind.arguments[2];
  _tempArray = list.split(delimiter);
  for(i = 0; i < _tempArray.length; i++){
    if(_tempArray[i] == value){
      returnValue = i;
      break;
    }
  }
  return returnValue;
}

function ListFindNoCase(list, value){
  var i = 0;
  var delimiter = ',';
  var returnValue = -1;
  var _tempArray = new Array();
  if(ListFindNoCase.arguments.length == 3)
    delimiter = ListFindNoCase.arguments[2].toLowerCase();
  list = list.toLowerCase();
  value = value.toLowerCase();
  _tempArray = list.split(delimiter);
  for(i = 0; i < _tempArray.length; i++){
    if(_tempArray[i] == value){
      returnValue = i;
      break;
    }
  }
  return returnValue;
}


function ListLast(list){
  var delimiter = ',';
  var returnValue = '';
  var _tempArray = new Array();
  if(ListLast.arguments.length == 2) delimiter = ListLast.arguments[1].toLowerCase();
  _tempArray = list.split(delimiter);
  if(_tempArray.length)
    returnValue = _tempArray[_tempArray.length - 1];
  else
    returnValue = list;
  return returnValue;
}

function astm_upload_pic(){
	if(ListFind('gif,jpg,jpeg,bmp,png,GIF,JPG,JPEG,BMP,PNG', ListLast(astm_form.filepic.value, '.')) == -1){
		alert('مسموح فقط بالامتدادت التالية \n GIF,JPG,JPEG,BMP,PNG');
		document.getElementById("filepic").outerHTML = "<input type='file' name='filepic' id='filepic'  onChange='return astm_upload_pic()' class='field' style='text-align:center; width:250'  onblur=\"this.className='field'\"  onfocus=\"this.className='field2'\"/>";
		return false;
	}
}
<!--------------------------------------------------------------------->
var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;

var origWidth, origHeight;

if (nodyn) { event = "nope" }

var tipFollowMouse= true;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 100;
var offX= 10;	// how far from mouse to show tip
var offY= 10; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "10pt";
var tipFontColor= "#000000";
var tipBgColor= "#DFF3FA"; 
var tipBorderColor= "#DFF3FA";
var tipBorderWidth= 1;
var tipBorderStyle= "ridge";
var tipPadding= 4;

var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = tooltip.style;
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipcss.width = tipWidth+"px";
		tipcss.fontFamily = tipFontFamily;
		tipcss.fontSize = tipFontSize;
		tipcss.color = tipFontColor;
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = initTip;
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function doTooltip(num,Img,Comment) {

var messages = new Array();


messages[0] = new Array(Img,Comment,"#ffffff");
messages[1] = new Array(Img,Comment,"#DFF3FA");

if (document.images) {
	var theImgs = new Array();
	for (var i=0; i<messages.length; i++) {
  	theImgs[i] = new Image();
		theImgs[i].src = messages[i][0];
  }
}

var startStr = '<table width="' + tipWidth + '" align="center"><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0"  width="130" height="97" class="border"></td></tr><tr><td valign="top" align="right" class="textblack">';
var endStr = '</td></tr></table>';
 
	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;
	if (messages[num][2])	var curBgColor = messages[num][2];
	else curBgColor = tipBgColor;
	if (messages[num][3])	var curFontColor = messages[num][3];
	else curFontColor = tipFontColor;
	if (ie4||ie5||ns5) {
		var tip = startStr + messages[num][0] + midStr + '<span class="textblack">' + messages[num][1] + '</span>' + endStr;
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}

function positionTip(evt) {
	if (!tipFollowMouse) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = mouseX-(tpWd+offX)+"px";
	else tipcss.left = mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+offY)+"px";
	else tipcss.top = mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}
document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>')

<!--------------------------------------------------------------------->
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 clearf(object,text){ if(object.value == text){object.value = ""; object.focus();}} 
function setf(object,text){ if(object.value == ""){object.value = text; this.focus(); }}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function AddFa(){
  window.external.addFavorite('http://www.e7trf.com/','شبكة احتراف')
}

function yesorno(y){ 
x=confirm(y);
if (x==true) 
{
return true
}
if (x==false) 
{
return false
}
}

function astmRestore(){
 document.getElementById('Image1').src='images/rate1.gif';
 document.getElementById('Image2').src='images/rate1.gif';
 document.getElementById('Image3').src='images/rate1.gif';
 document.getElementById('Image4').src='images/rate1.gif';
 document.getElementById('Image5').src='images/rate1.gif';
}

function astm_vote(x){
if(x==1){
 document.getElementById('show_vote').style.display='block';
 document.getElementById('show_result').style.display='none';
 return false
}else{
 document.getElementById('show_vote').style.display='none';
 document.getElementById('show_result').style.display='block';
 return false
}
}

function astm_expandIt(astm_id){
    var tdiv = document.getElementById(astm_id);
    var tpic = document.getElementById('astm'+astm_id);
    if (tdiv.style.display == '') {
        tdiv.style.display = 'none';
        tpic.src = 'images/plus.gif';
		tpic.title="افتح";
    } else {
        tdiv.style.display = '';
        tpic.src = 'images/min.gif';
		tpic.title="اقفل";
    }
}

function astmCopy(myprefix){
Copied = eval ('document.astm_copy.' + myprefix + '.createTextRange();');
Copied.execCommand("Copy");
eval ('document.astm_copy.' + myprefix + '.select();');
alert('تم النسخ بنجاح');
}

function astm_print(){window.print();}

function astm_tellfriend(){
str = document.form_tell.email.value;
if (str.indexOf('@') == -1 || str.indexOf('.') == -1)
{
alert ('من فضلك ادخل البريد الالكتروني بشكل صحيح');
document.form_tell.email.focus();
return false;
}
}

function astm_Ser(){
if (document.AstmSer.SER.value=="" || document.AstmSer.SER.value=="مفردات البحث"){
alert("من فضلك اكتب مفردات البحث")
document.AstmSer.SER.focus()
return false
}
if (document.AstmSer.Kind.value==""){
alert("من فضلك اختار قسم")
document.AstmSer.Kind.focus()
return false
}
}

function astm_maillist(){
/*
if (document.FormMailList.name.value=="" || document.FormMailList.name.value=="الاسم"){
alert("من فضلك اكتب اسمك")
document.FormMailList.name.focus()
return false
}
*/
str = document.FormMailList.MailList.value;
if (str.indexOf('@') == -1 || str.indexOf('.') == -1)
{
alert ('من فضلك ادخل البريد الالكتروني بشكل صحيح');
document.FormMailList.MailList.focus();
return false;
}
}

function astm_comment(){
if (document.formcomment.comment.value==""){
alert("من فضلك اكتب التعليق")
document.formcomment.comment.focus()
return false
}
}

function astm_show_comment(x){
if(x==1){
 document.getElementById('show_com').style.display='block';
 return false
}else{
 document.getElementById('show_com').style.display='none';
 return false
}
}

function astm_login(){
if (document.FormLog.UserName.value=="" || document.FormLog.UserName.value=="اسم المستخدم"){
alert("من فضلك اكتب اسم المستخدم")
document.FormLog.UserName.focus()
return false
}

if (document.FormLog.PassWord.value=="" || document.FormLog.PassWord.value=="كلمة السر"){
alert("من فضلك اكتب كلمة السر")
document.FormLog.PassWord.focus()
return false
}

}

function astm_Register(){
/*
if (document.formRegister.name.value==""){
alert("من فضلك اكتب اسمك الثلاثى")
document.formRegister.name.focus()
return false
}
*/
if (document.formRegister.user.value==""){
alert("من فضلك اكتب اسم المستخدم")
document.formRegister.user.focus()
return false
}

if (document.formRegister.pass.value==""){
alert("من فضلك اكتب كلمة السر")
document.formRegister.pass.focus()
return false
}

if (document.formRegister.pass2.value !== document.formRegister.pass.value){
alert("من فضلك تأكد من ان كلمة السر متساوية مع تأكيد كلمة السر")
document.formRegister.pass2.focus()
return false
}

str = document.formRegister.email.value;
if (str.indexOf('@') == -1 || str.indexOf('.') == -1){
alert ('من فضلك ادخل البريد الالكتروني بشكل صحيح');
document.formRegister.email.focus();
return false;
}

if (document.formRegister.email2.value !== document.formRegister.email.value){
alert("من فضلك تأكد من ان البريد الالكتروني متساوى مع تأكيد البريد الالكتروني")
document.formRegister.email2.focus()
return false
}

}

function astm_forget(){
str = document.formforget.email.value;
if (str.indexOf('@') == -1 || str.indexOf('.') == -1){
alert ('من فضلك ادخل البريد الالكتروني بشكل صحيح');
document.formforget.email.focus();
return false;
}
}

function astm_mobile(x){

if (document.astm_form.name.value==""){
alert("من فضلك ادخل اسم " + x)
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if(x=="التوبيك"){
if (document.astm_form.code.value==""){
alert("من فضلك ادخل شكل " + x)
document.astm_form.code.focus()
return false
}
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل " + x)
document.astm_form.msg.focus()
return false
}

}

function astm_prog(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم البرنامج")
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.url.value==""){
alert("من فضلك ادخل رابط البرنامج")
document.astm_form.url.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/
}

function astm_thum(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم الثيم")
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.url.value==""){
alert("من فضلك ادخل رابط الثيم")
document.astm_form.url.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/
}

function astm_bluetooth(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم المقطع")
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.url.value==""){
alert("من فضلك ادخل رابط المقطع")
document.astm_form.url.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/
}
function astm_mgame(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم اللعبة")
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.url.value==""){
alert("من فضلك ادخل رابط اللعبة")
document.astm_form.url.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/
}

function astm_gallery(x){
if(x<1){	
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل تعليق")
document.astm_form.msg.focus()
return false
}	
}

function astm_media(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم الفيديو")
document.astm_form.name.focus()
return false
}

if (document.astm_form.url.value=="" || document.astm_form.url.value=="http://"){
alert("من فضلك اكتب كود الفيديو")
document.astm_form.url.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){	
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/	
}

function astm_game(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم اللعبة")
document.astm_form.name.focus()
return false
}

if (document.astm_form.url.value=="" || document.astm_form.url.value=="http://"){
alert("من فضلك اكتب رابط اللعبة")
document.astm_form.url.focus()
return false
}


if (document.astm_form.height.value=="" || isNaN(document.astm_form.height.value)){
alert("من فضلك ادخل الطول ارقام")
document.astm_form.height.focus()
return false
}

if (document.astm_form.width.value=="" || isNaN(document.astm_form.width.value)){
alert("من فضلك ادخل العرض ارقام")
document.astm_form.width.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){	
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/
}
function astm_flag(x){
document.getElementById('astm_pic').src='flags/'+x+'.gif';
}
function astm_dlel(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم الموقع")
document.astm_form.name.focus()
return false
}

if (document.astm_form.url.value=="" || document.astm_form.url.value=="http://"){
alert("من فضلك اكتب رابط الموقع")
document.astm_form.url.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.country.value==""){
alert("من فضلك اختار دولة")
document.astm_form.country.focus()
return false
}


if (document.astm_form.meta.value==""){
alert("من فضلك ادخل كلمات مفتاحية")
document.astm_form.meta.focus()
return false
}	

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){	
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/

}
function astm_sex(){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم المقالة")
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}
if (document.astm_form.mes.value==""){
alert("من فضلك ادخل نص المقالة")
document.astm_form.mes.focus()
return false
}

}

function astm_islam(x){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم الكتاب")
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار القسم")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.url.value==""){
alert("من فضلك ادخل رابط الكتاب")
document.astm_form.url.focus()
return false
}

if (document.astm_form.size.value=="" || isNaN(document.astm_form.size.value)){
alert("من فضلك ادخل الحجم ارقام")
document.astm_form.size.focus()
return false
}

if (document.astm_form.msg.value==""){
alert("من فضلك ادخل وصف")
document.astm_form.msg.focus()
return false
}	

/*
if(x<1){	
if (document.astm_form.filepic.value==""){
alert("من فضلك اختار الصورة")
document.astm_form.filepic.focus()
return false
}
}
*/
}
function astm_quran(){
if (document.astm_form.name.value==""){
alert("من فضلك اكتب اسم السورة")
document.astm_form.name.focus()
return false
}

if (document.astm_form.sec.value==""){
alert("من فضلك اختار المقرىء")
document.astm_form.sec.focus()
return false
}

if (document.astm_form.url.value==""){
alert("من فضلك ادخل رابط السورة")
document.astm_form.url.focus()
return false
}

}
