function setPrayTimeCity(id){
	document.getElementById("prayTime_z").style.display = "none";
	for(var i=0; i<=6; i++){
		document.getElementById("prayCity"+i).innerHTML = "&nbsp;";
	}
	var cityID = id.substr(id.length-1, 1);
		document.getElementById("prayCity"+cityID).innerHTML = "&raquo;";
	
	for(var j=0; j<=6; j++){
		document.getElementById("prayTime_"+j).style.display = "none";
	}
	document.getElementById("prayTime_"+cityID).style.display = "block";
}
function ChangeTabBlock(id){
	for(var i=0; i<=4; i++){
		document.getElementById("blockTab"+i).className = "inactive";
	}
	document.getElementById(id).className = "active";
	loadBlock();
}
function ChangeSeacher(id){
	if(last_tab!="undefined" && last_tab!="")
		document.getElementById(last_tab).className=""
	document.getElementById(id).className = "tabs_active"
	//document.getElementById('searchbox').className = id+"_active"
	last_tab = id;
	writeCookie("last_active_tab", id, 24);
	document.sf.q.focus();
	tab = eval(id.substring(3,5));
	document.sf.elements[0].name=''
	document.sf.action = Factions[tab]
	document.sf.elements[0].name= tab<2 ? 'action' : 'psearch';
	document.sf.elements[0].value = actions[tab]
	aid = "a"+tab;
	document.getElementById('stext').innerHTML = 'جستجو  در '+document.getElementById(aid).innerHTML
	sub_str = "";
	for(i=0;i<subs[tab].length;i++){
		sub_str+= "<span class=\"subs\">&nbsp;<a href=\""+links[tab][i]+"\">"+subs[tab][i]+"</a></span>";
	}
	document.getElementById('srchbtn').innerHTML = sub_str
}

function Picture(pic,title,width,height)
{
    popup = window.open(pic, title, 'width='+width+', height='+height+', toolbar=no, directories=no, status=no, scrollbars=no, resizable=yes, menubar=no');
    popup.focus();
}

function checkAll(checkBox)
{
    var v = checkBox.checked;
    var f = checkBox.form;
    for (var i = 0; i < f.elements.length; i++) {
        if (f.elements[i].type == "checkbox") {
            f.elements[i].checked = v;
            }
        }
}
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

function change_news_table(){
	var thisNewsId = "col_news";
	n_string = '<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%" style="background-color:#e3e3e3;padding:10px;padding-top:20px;padding-bottom:20px;">'+document.getElementById(thisNewsId).innerHTML+'</td></tr></table>';

	//document.getElementById(thisNewsId).innerHTML = n_string;
}

function change_announce_table(){
	var thisAnnounceId = "col_announcement";
//	a_string = '<table width="100%" bgcolor="#FDFDFD" height="100" cellpadding="0" cellspacing="0" border="0"><tr height="7"><td width="48" valign="top" style="background-image:url(\'images/theme1/news2-topleft_t.jpg\');"><img src="images/theme1/news2-bottom_righttop.jpg" width="48" height="6" alt=""></td><td height="7" style="border-top:1px solid #DDDDDD;font-size:1px;font-family:tahoma;" width="100%">&nbsp;</td><td><img src="images/theme1/news-topleft.jpg" width="11" height="7" alt=""></td></tr><tr><td colspan="3" style="background-image:url(\'images/theme1/news2-right_bg.jpg\');background-position:top right;background-repeat:repeat-y;border-left:1px solid #DDDDDD; border-right:1px solid #DDDDDD;"><table width="100%"height="100%" cellpadding="0" cellspacing="0"><tr><td width="48" align="right" style="padding-right:3px;" valign="middle"><img src="images/theme1/news2.jpg" width="19" height="90" alt=""></td><td valign="top" style="padding:3px;">'+document.getElementById(thisAnnounceId).innerHTML+'</td></tr></table></td></tr><tr><td height="6"><img src="images/theme1/news2-bottom_right.jpg" width="48" height="6" alt=""></td><td style="border-bottom:1px solid #DDDDDD;font-size:1px;font-family:tahoma;">&nbsp;</td><td height="6"><img src="images/theme1/news-bottom_leftt.jpg" width="11" height="6" alt=""></td></tr></table>';
//	document.getElementById(thisAnnounceId).innerHTML = a_string;
}


