function MenuHide(){
	if (MenuOnOff.value=='Off'){
		HD('Itemes1'); HD('Itemes2'); MenuOnOff.value='On';
		HD('PMenu1'); HD('PMenu2');
	}
}

function MenuShow(num){
	MenuOnOff.value='On'; 
	if (document.getElementById('Itemes'+num).style.display=='none') VD('Itemes'+num);
	VD('PMenu'+num)
}

function Invert(element, color){
	if (color == "t")
		document.getElementById(element).style.color = "#ffffff";
	else
		document.getElementById(element).style.color = "#333333";
}

function boxer(num, total_menu){
	menu = "Menu_Box" + num ;
	docMenu = document.getElementById(menu) ;
	box(menu);
	
	if (docMenu.style.display=="block"){
		currH = docMenu.offsetHeight
		docMenu.style.height = "1px";	
		for (var i = 0 ; i < currH ; i++){
			setTimeout("docMenu.style.height = " + i + " + 'px'", i);
		}
	}
	
	for (var x = 1 ; x < total_menu ; x++){		
		if (x != num){
			document.getElementById("Menu_Box" + x).style.display = "none" ;
			document.getElementById("titleMenu" + x).style.backgroundPosition = "0px 0px" ;
			document.getElementById("titleMenu" + x).style.color = "" ;
			document.getElementById("arrow" + x).style.color = "#CCC";
			document.getElementById("arrow" + x).innerText = 6;
		}
	}
	
	if (docMenu.style.display == "block"){
		document.getElementById("titleMenu" + num).style.backgroundPosition = "0px 24px" ;
		document.getElementById("titleMenu" + num).style.color = "#C30" ;
		document.getElementById("arrow" + num).innerText = 5;
		document.getElementById("arrow" + num).style.color = "#C30";
	}
	else{
		document.getElementById("titleMenu" + num).style.backgroundPosition = "0px 0px" ;
		document.getElementById("titleMenu" + num).style.color = "" ;
		document.getElementById("arrow" + num).innerText = 6;
		document.getElementById("arrow" + num).style.color = "#CCC";
	}
	
}

function setArrow(aname, OnOff){
	var inSpan = document.getElementById(aname).innerText
	if (OnOff==true)
		document.getElementById(aname).style.color = "#C30" ;
	else{
		if (inSpan==6)
			document.getElementById(aname).style.color = "#CCC" ;
	}
}

function CLeft(win_width){
	poXX = win_width / 2 ;
	poX = screen.availWidth ;
	poX = (poX / 2) - win_width + poXX ;
	return poX;
}

function CTop(win_height){
	poYY = win_height / 2 ;
	poY = screen.availHeight ;
	poY = (poY / 2) - win_height + poYY ;
	return poY;
}

function mrqUP(element){
	document.getElementById(element).direction="up"
	document.getElementById(element).scrollAmount="18"
}

function mrqDN(element){
	document.getElementById(element).direction="down"
	document.getElementById(element).scrollAmount="18"
}

function mrq(element){
	document.getElementById(element).direction="up"
	document.getElementById(element).scrollAmount="2"
}

function PG(scr){
	hideMe()
	if (scr == "f"){}
	else {top.location = "#up"}
	setSize()
}

function SSF(){
	frame = document.getElementById("PageSRC")
	var b = frame.contentWindow.document.body;
	var h = b.scrollHeight;
	 if (h > 0)
	 	frame.height = h + 5;
}

function setSize(){
	document.getElementById('PageSRC').contentWindow.top.SSF()
}

function yourMessage(){	
	window.open('./message/index.html','YourMessage','width=635, height=600,top='+CTop(600)+',left='+CLeft(635)+'status=yes,resizable=yes')
}

function box(element){
	current=(document.getElementById(element).style.display == "none") ? "block" : "none";
	document.getElementById(element).style.display = current;
}

function VD(element){
	document.getElementById(element).style.display="block" ;
}

function HD(element){
	document.getElementById(element).style.display="none" ;
}

function friends(){
	window.open('./contactus/Send_Friend.html','SFriend','width=500,height=170,top='+CTop(170)+',left='+CLeft(500)+',status=yes')
}

function mail(){
	window.open('./contactus/contactus.html','SMail','width=485,height=500,top='+CTop(500)+',left='+CLeft(610)+',status=yes')
}

function CText(element, mt){
	document.getElementById(element).focus()
	document.execCommand("SelectAll")
	document.execCommand("Copy")
	alert(mt+" در حافظه موقت سیستم شما ذخیره شد")
}

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
	topDog=isIE ? "BODY" : "HTML";
	whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
	hotDog=isIE ? event.srcElement : e.target;  
	while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
		hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
	}  
	if (hotDog.id=="titleBar"){
		offsetx=isIE ? event.clientX : e.clientX;
		offsety=isIE ? event.clientY : e.clientY;
		nowX=parseInt(whichDog.style.left);
		nowY=parseInt(whichDog.style.top);
		ddEnabled=true;
		document.onmousemove=dd;
	}
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
	if (!isN4) return;
		N4=eval(whatDog);
		N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
		N4.onmousedown=function(e){
		N4.captureEvents(Event.MOUSEMOVE);
		N4x=e.x;
		N4y=e.y;
	}
	N4.onmousemove=function(e){
		if (isHot){
			N4.moveBy(e.x-N4x,e.y-N4y);
			return false;
		}
	}
		N4.onmouseup=function(){
		N4.releaseEvents(Event.MOUSEMOVE);
	}
}

function hideMe(){
	if (isIE||isNN) whichDog.style.visibility="hidden";
	else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
	if (isIE||isNN) whichDog.style.visibility="visible";
	else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");	

function checkMail(Expression){
	var x = Expression;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	else return false;
}
function chkM(element) {
	if ((element.email.value=='ایمیل شما') | (element.email.value=='')) {
		alert ('آدرس ایمیل خالى است');                          
		element.email.focus();                          
		return false;                          
	}
	
	if (!checkMail(element.email.value)) {                          
		alert ('ايميل را به شکل صحيح وارد کنيد');                          
		element.email.focus();                          
		element.email.select();
		return false;
	}
	document.getElementById("winMembership").style.height = 16 ;
	document.getElementById("winMembership").style.width = 250 ;	
	return true;
}

function chkSearch() {
	element = document.getElementById('cse-search-box') ;
	if ((element.q.value=='جستجو...') | (element.q.value=='')) {
		alert ('فیلد جستجو خالی است');                          
		element.q.focus();                          
		return false;                          
	}
	return true;
}

function end(){
document.getElementById('theLayer').style.display='block'
loding("end")
VD("YahooId") ;
window.status = document.title
wellcom.style.display = "block"
PageSRC.location = "post/FirstPage.html"
MenuPopup.style.display = "block"
document.oncontextmenu=new Function("return true") ;

var theSummaries = new Array(

"مبارک باد آمد ماه روزه",
"رهت‏ خوش باد، اي همراه روزه",
"شدم بر بام تا مه را ببينم",
"که بودم من به جان دلخواه روزه",
"نظر کردم کلاه از سر بيفتاد",
"سرم را مست کرد آن شاه روزه",
"مسلمانان، سرم مست است از آن روز",
"زهي اقبال و بخت و جاه روزه",
"بجز اين ماه، ماهي هست پنهان",
"نهان چون ترک در خرگاه روزه",
"بدان مه ره برد آن کس که آيد",
"درين مه خوش به خرمنگان روزه",
"رخ چون اطلسش گر زرد گردد",
"بپوشد خلعت از ديباه روزه",
"دعاها اندرين مه مستجاب است",
"فلکها را بدرد آه روزه",
"چو يوسف ملک مصر عشق گيرد",
"کسي کو صبر کرد در چاه روزه",
"سحوري کم زن اي نطق و خمش آن",
"ز روزه خود شوند آگاه روزه",
"( کليات شمس، جزء و پنجم، ص 137 )"
);

var theSiteLinks = new Array();
var theCharacterTimeout=70;
var theStoryTimeout=2000;
var theWidgetOne="_";
var theWidgetTwo="-";var theWidgetNone="";
var theItemCount=theSummaries.length;
var NS6=(document.getElementById&&!document.all)?true:false;

function startTicker(){
theCurrentStory=-1;
theCurrentLength=0;
if(document.getElementById){runTheTicker();}
else{
document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");return true;}}

function runTheTicker(){
var myTimeout;
if(theCurrentLength==0){theCurrentStory++;
theCurrentStory=theCurrentStory%theItemCount;
theStorySummary=theSummaries[theCurrentStory];
theTargetLink=theSiteLinks[theCurrentStory];}

var textTitle=theStorySummary.substring(0,theCurrentLength)+whatWidget();
if(theTargetLink){
if(NS6){document.getElementById("theTicker").innerHTML='<a class="payam" href="'+theTargetLink+'" target="_top">'+textTitle+'</a>';}
else{document.all.theTicker.innerHTML='<a class="payam" href="'+theTargetLink+'" target="_top">'+textTitle+'</a>';}}
else{if(NS6){document.getElementById("theTicker").innerHTML='<span class="tickertext">'+textTitle+'</span>';}
else{document.all.theTicker.innerHTML='<span class="tickertext">'+textTitle+'</span>';}}
if(theCurrentLength!=theStorySummary.length){theCurrentLength++;myTimeout=theCharacterTimeout;}
else
{theCurrentLength=0;myTimeout=theStoryTimeout;}
setTimeout("runTheTicker()",myTimeout);}

function whatWidget(){if(theCurrentLength==theStorySummary.length){return theWidgetNone;}
if((theCurrentLength%2)==1){return theWidgetOne;}
else
{return theWidgetTwo;}};
sherBox.value = theSummaries ;
setTimeout('wellcom.style.display = "none";theTicker.style.display = "block"; startTicker()', 8000 );

// iframes Actived **************
LogoLinkSRC.location = "Images/Logo/LogoLink.html" ;
HD("Wait_1"); VD("LogoLinkSRC") ;

//SMetter.location = "Programs/SMetter.php" ;
//HD("Wait_2"); VD("SMetter") ;

//Members.location = "Programs/Members.php" ;
}