/*==================================================================================*\
|| ################################################################################ ||
|| # 			 Elbayt NetWork For Disigning & Developing WebSites				  #	|| 
|| # ---------------------------------------------------------------------------- # ||
|| # All PHP code in this file is ©2005-2006 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 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 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 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);
}

<!--------------------------->
 message = "  ^" +
                "^"
  scrollSpeed = 0
  lineDelay   = 0
  txt         = ""
  function scrollText(pos) {
    if (message.charAt(pos) != '^') {
      txt    = txt + message.charAt(pos)
      status = txt
      pauze  = scrollSpeed
    }
    else {
      pauze = lineDelay
      txt   = ""
      if (pos == message.length-1) pos = -1
    }
    pos++
    setTimeout("scrollText('"+pos+"')",pauze)
  }
scrollText(0)
<!--------------------------->

<!--------------------------->
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= "#D9D9D9"; 
var tipBorderColor= "#D9D9D9";
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,"#D9D9D9");

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_gray"></td></tr><tr><td valign="top" align="right" class="textorange">';
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="textorange">' + 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>')

<!----Txt Marquee ----------------------->
var currentState = 'started';
function tickerPlay(dir){
var tickerObj = document.getElementById('tickerObj');
var pauseImage = document.getElementById('pauseImage');
if (dir == 1) {
tickerObj.direction = 'left'; 
tickerObj.start(); 
currentState = 'stopped';
pauseImage.click();
}else if(dir == -1) {
tickerObj.direction = 'right'; 
tickerObj.start(); 
currentState = 'stopped';
pauseImage.click();
}else {
// save last dir, restart
if (currentState == 'started') { 
tickerObj.stop();
event.srcElement.src = event.srcElement.playImage;
currentState = 'stopped';
}else {
event.srcElement.src = event.srcElement.stopImage;
tickerObj.start();
currentState = 'started';
}
}
}
<!----Txt Marquee --------------------------->
<!-- News Marquee --------------------------->
var CurrentSelectedMainThird=0
var ImageUpID=''
var CurrentSelectedMainThird=0
var ImageUpID=''
function ScrollingNewsCenterUp(Obj){
ScrollingNewsCenterUpTimer(Obj,Math.abs(eval(Math.round(document.getElementById('tblHeadLinesTap'+CurrentSelectedMainThird).offsetHeight/document.getElementById('tblHeadLinesTap'+CurrentSelectedMainThird).getElementsByTagName('tr').length))-document.getElementById(Obj).scrollTop+20),document.getElementById(Obj).scrollTop)
}

function ScrollingNewsCenterUpTimer(Obj,YSize,StartSize){
if (StartSize>=YSize){
document.getElementById(Obj).scrollTop=StartSize
window.setTimeout("ScrollingNewsCenterUpTimer('"+Obj+"',"+YSize+","+eval(eval(StartSize)-eval(1))+")",10)
document.getElementById('imgMainThirdScrollingDown'+ImageUpID).src='images/down.gif';
document.getElementById('imgMainThirdScrollingDown'+ImageUpID).style.cursor='pointer'
}else if (YSize>StartSize+1){
document.getElementById(Obj).scrollTop=0
document.getElementById('imgMainThirdScrollingUp'+ImageUpID).src='images/up.gif';
document.getElementById('imgMainThirdScrollingUp'+ImageUpID).style.cursor='default'
}
}

function ScrollingNewsCenterDown(Obj){
ScrollingNewsCenterDownTimer(Obj,eval(document.getElementById('tblHeadLinesTap'+CurrentSelectedMainThird).offsetHeight/document.getElementById('tblHeadLinesTap'+CurrentSelectedMainThird).getElementsByTagName('tr').length)+document.getElementById(Obj).scrollTop+20,document.getElementById(Obj).scrollTop)
}

function ScrollingNewsCenterDownTimer(Obj,YSize,StartSize){	
if (StartSize<=YSize){
document.getElementById(Obj).scrollTop=StartSize
window.setTimeout("ScrollingNewsCenterDownTimer('"+Obj+"',"+YSize+","+eval(eval(StartSize)+eval(1))+")",10)
document.getElementById('imgMainThirdScrollingUp'+ImageUpID).src='images/up.gif';
document.getElementById('imgMainThirdScrollingUp'+ImageUpID).style.cursor='pointer'
}else if(eval(document.getElementById(Obj).scrollHeight - document.getElementById(Obj).style.height.replace('px',''))<=document.getElementById(Obj).scrollTop)
{
document.getElementById('imgMainThirdScrollingDown'+ImageUpID).src='images/down.gif';
document.getElementById('imgMainThirdScrollingDown'+ImageUpID).style.cursor='default'
}	
}
<!-- News Marquee --------------------------->
function astm_voit(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_print(){window.print();}
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_show(x){
	if(x==1){
	 document.getElementById('show_add_comment').style.display='block';
	 document.getElementById('show_comment').style.display='none';
	 return false
	}else{
	 document.getElementById('show_add_comment').style.display='none';
	 document.getElementById('show_comment').style.display='block';
	 return false
	}
}

function astm_comment(){
if (document.formcomment.name.value==""){
alert("من فضلك اكتب اسمك")
document.formcomment.name.focus()
return false
}
if (document.formcomment.comment.value==""){
alert("من فضلك اكتب التعليق")
document.formcomment.comment.focus()
return false
}
}

function astm_contact(){
if(document.form_contact.name.value==""){
alert('من فضلك ادخل اسمك');
document.form_contact.name.focus();
return false;
}

str = document.form_contact.email.value;
if (str.indexOf('@') == -1 || str.indexOf('.') == -1)
{
alert ('من فضلك ادخل البريد الالكتروني بشكل صحيح');
document.form_contact.email.focus();
return false;
}



if(document.form_contact.address.value==""){
alert('من فضلك اكتب العنوان ');
document.form_contact.address.focus();
return false;
}

if(document.form_contact.tell.value!==""){
	if(isNaN(document.form_contact.tell.value)){
alert('من فضلك اكتب رقم الهاتف ارقام');
document.form_contact.tell.focus();
return false;
	}
}

if(document.form_contact.fax.value!==""){
	if(isNaN(document.form_contact.fax.value)){
alert('من فضلك اكتب رقم الفاكس ارقام');
document.form_contact.fax.focus();
return false;
	}
}

if(document.form_contact.msg.value==""){
alert('من فضلك اكتب نص الرسالة');
document.form_contact.msg.focus();
return false;
}

}



function astm_counsel(){
if(document.form_counsel.name.value==""){
alert('من فضلك ادخل اسمك');
document.form_counsel.name.focus();
return false;
}

str = document.form_counsel.email.value;
if (str.indexOf('@') == -1 || str.indexOf('.') == -1)
{
alert ('من فضلك ادخل البريد الالكتروني بشكل صحيح');
document.form_counsel.email.focus();
return false;
}



if(document.form_counsel.address.value==""){
alert('من فضلك اكتب العنوان ');
document.form_counsel.address.focus();
return false;
}

if(document.form_counsel.tell.value!==""){
	if(isNaN(document.form_counsel.tell.value)){
alert('من فضلك اكتب رقم الهاتف ارقام');
document.form_counsel.tell.focus();
return false;
	}
}

if(document.form_counsel.msg.value==""){
alert('من فضلك اكتب نص المشكلة');
document.form_counsel.msg.focus();
return false;
}

}

