if(docDate == null)
	var docDate = "";

if(id == null)
	var id = "";

var i=0;
var title=new Array;
//title[0]="اتصلوا بنا";
title[0]="%u0627%u062A%u0635%u0644%u0648%u0627%20%u0628%u0646%u0627";
//title[1]="خريطة الموقع";
title[1]="%u062E%u0631%u064A%u0637%u0629%20%u0627%u0644%u0645%u0648%u0642%u0639";
//title[2]="مركز المساعدة";
title[2]="%u0645%u0631%u0643%u0632%20%u0627%u0644%u0645%u0633%u0627%u0639%u062F%u0629";
title[3]="حول الموقع";
title[3]="%u062D%u0648%u0644%20%u0627%u0644%u0645%u0648%u0642%u0639";
//title[4]="الصفحة الرئيسية";
title[4]="%u0627%u0644%u0635%u0641%u062D%u0629%20%u0627%u0644%u0631%u0626%u064A%u0633%u064A%u0629";

// yahya kateeb 
var home_temp_type		= "44"	; //as default
var home_template_id	= "-1"	;
var sys_lang			= "1"	; // english as default
var sys_cu_no			= "1"	; // as default
// yahya kateeb 
var style_id			= "2"	; // as default

if(document.all.item("styleId"))
	if(document.all.item("styleId").length)
			style_id	=	(document.all.item("styleId"))[0].value	;
		else
			style_id		= document.all.item("styleId").value	;	


if(document.all.item("home_page"))
	if(document.all.item("home_page").length)
	{
		home_temp_type		= (document.all.item("home_page"))[0].temp_type	;
		home_template_id	= (document.all.item("home_page"))[0].value		;	
	}
	else
	{
		 home_temp_type		= document.all.item("home_page").temp_type	;
		 home_template_id	= document.all.item("home_page").value		;	
	}

if(document.all.item("lang"))	
	if(document.all.item("cu_no").length)
		sys_lang	=	(document.all.item("lang"))[0].value		;
	else
		sys_lang	=	document.all.item("lang").value		;

if(document.all.item("cu_no"))
	if(document.all.item("cu_no").length)
	{
		sys_cu_no	=	(document.all.item("cu_no"))[0].value	;		
	}
	else
		sys_cu_no	=	document.all.item("cu_no").value	;

var home_page = "/site/topics/index.asp?cu_no=" + sys_cu_no + "&temp_type=" + home_temp_type  +"&template_id=" + home_template_id + "&lng=" + sys_lang ;

var logo_path  = "" ;
if(document.all.logoPath)
	if(document.all.logoPath.length)
		logo_path = (document.all.item("logoPath"))[0].value ;
	else
		logo_path = document.all.logoPath.value ;		

// end of yahya kateeb 

var link=new Array;
link[0]="#";
link[1]="#";
link[2]="#";
link[3]="#";
//link[4]="/xml/topics/index.xml";
link[4]=home_page;

function MainMenuHTML()
{
var html= "<table border='0' cellPadding='0' cellSpacing='0' bgColor=#d3e4fe><tr>";
html += "<td class='topMenuText' nowrap><a class='topMenuText' href="+link[0]+">"+unescape(title[0])+"</a></td>";
	for (var i=1; i<title.length; i++)
		if (id != "")
		{
  			if (link[i]!=home_page)
			{
				html += "<td class='topLabel'>|</td>"
	          	if (id != link[i])
		            html += "<td class='topMenuText' nowrap><a class='topMenuText' href="+link[i]+">"+unescape(title[i])+"</a></td>";
				else
		            html += "<td class='topMenuTextOn' nowrap><a class='topMenuTextOn' href="+link[i]+">"+unescape(title[i])+"</a></td>";
			}
			else
				html += "<td class='homePage' nowrap><a class='homePage' href="+link[i]+">"+unescape(title[i])+"</a></td>";
		}
        else
      		if (link[i]!=home_page)
			{
				html += "<td class='topLabel'>|</td>"
				html += "<td class='topMenuText' nowrap><a class='topMenuText' href="+link[i]+">"+unescape(title[i])+"</a></td>";
	        }
  html += "</tr></table>";
  document.all.top_menu.innerHTML = html;
}





function veiwDetail(detailId)
{
	//Header = detailId+'H';
	Icon = detailId+'I';	

	if (document.all[detailId].className != "hide")
	{
		document.all[detailId].className = "hide";
		document.all['td_'+detailId].className = "MenuText";		
	}
	else
	{
		
		document.all[detailId].className = "";		
		document.all['td_'+detailId].className = "selectedMenuTitle";
	}
	
}

function submitSearch()
{
	var cu_no = "1" ;
	if( document.all.cu_no )
	{
		cu_no = document.all.cu_no.value ; 
	}

	if( document.all.searchText != null  )
	{
		if(  window.document.readyState == "complete"  )
		{
			if( document.all.searchText.value == "")
			{
				//alert('You must enter search data');
				alert( unescape("%u0627%u0644%u0631%u062C%u0627%u0621%20%u0625%u062F%u062E%u0627%u0644%20%u0643%u0644%u0645%u0629%20%u0648%u0627%u062D%u062F%u0629%20%u0639%u0644%u0649%20%u0627%u0644%u0623%u0642%u0644")) ;

			}
			else
			{
				var  hrefVal ;
				hrefVal = "/site/topics/AdvSearchResult.asp?cu_no="+ cu_no +"&text=" + escape(document.all.searchText.value) ;
				window.location.href= hrefVal ;
			}
		}
		else
		{
//			alert("الرجاء الانتظار حتى تكتمل الصفحة");
			alert(unescape("%u0627%u0644%u0631%u062C%u0627%u0621%20%u0627%u0644%u0627%u0646%u062A%u0638%u0627%u0631%20%u062D%u062A%u0649%20%u062A%u0643%u062A%u0645%u0644%20%u0627%u0644%u0635%u0641%u062D%u0629"));
		}
	}
	

}

function chkOnline()
{
	if (document.all.temp_type && document.all.flgOnline)
		switch (document.all.temp_type.value)
		{
			case "44": 
			case "41": 
			case "42": 
			return true;
			brack;
			defualt:
			return false;
			brack;
		}
}


function searchBody()
{
	var html = "<table cellspacing='0' cellpadding='0' width='100%'>";
	var cu_no = "1" ;
	if( document.all.cu_no )
	{
		cu_no = document.all.cu_no.value ; 
	}
	html += "<tr>";
	html += "<td class='searchArea' style='border: 1 solid'>";
	//html += "ابحث في موقع القرضاوي";
	html += unescape("%u0627%u0644%u0628%u062D%u062B");

	if (chkOnline()){
		html += "<br/><input type='text' id='searchText' name='searchText' size='22' onkeydown='if (window.event.keyCode == 0x0d)submitSearch()' />";
	}
	else{
		html += "<br/><input type='text' id='searchText' name='searchText' size='20' onkeydown='if (window.event.keyCode == 0x0d)submitSearch()'/>";
	}
	html += "<br/><a href='javascript:submitSearch();'><IMG src='/site/images/go.gif' border='0'/></a>";	

	html += "<a href='/site/topics/search/ADVSearch.asp?cu_no="+cu_no+"' ><IMG src='/site/images/detailed-search.gif' border='0' style='margin-right:45'/></a>";
	html += "</td>";
	html += "</tr>";
	html += "</table>";

	if(eval(document.all.searchArea))
		document.all.searchArea.innerHTML = html ;
}

//email
function openSendByEmailPage()
{
	window.open("/sendByEmail.htm",null,"height=250,width=450,status=yes,toolbar=no,menubar=no,location=no, resizable=yes")	
}


function advertise()
{
	var html = "<table cellspacing='0'  cellpadding='0'  width='100%' bgColor=#d3e4fe>";
	
	html	+= "<tr>";
	html	+= "<td><img border=\"0\" src=\"/site/images/spacer.gif\" width=\"18px\">";
	html	+= "</td>";
	html	+= "</tr>";
	
	html	+= "<tr>";
	if( document.all.ph_path && document.all.ph_path.value == "1" )	
		html	+= "<td align=\"center\"><a href=\"http://www.101days.org/\"><img border=\"0\" src=\"/site/images/support-site.gif\"></a></td>";
	else
		html	+= "<td align=\"center\"><a href=\"/site/topics/static.asp?cu_no="+ document.all.cu_no.value +"&template_id=185\">"+"<img border=\"0\" src=\"/site/images/support-site.gif\"></a></td>";
	html	+= "</tr>";
	
	html	+= "<tr>";
	html	+= "<td><img border=\"0\" src=\"/site/images/spacer.gif\" width=\"18px\">";
	html	+= "</td>";
	html	+= "</tr>";
		
	html	+= "<tr>";
	if( document.all.ph_path && document.all.ph_path.value == "1" )	
		html	+= "<td align=\"center\"><a href=\"http://www.101days.org/\"><img border=\"0\" src=\"/site/images/itlaf.jpg\"></a></td>";
	else
		html	+= "<td align=\"center\"><a href=\"/site/topics/article.asp?cu_no="+ document.all.cu_no.value+ "&item_no=1548&version=1&template_id=-1&parent_id=-1"+"\">"+"<img border=\"0\" src=\"/site/images/itlaf.jpg\"></a></td>";
		//html	+= "<td align=\"center\"><a href=\"/xml/topics/advertise.xml?cu_no="+ document.all.cu_no.value +"\">"+"<img border=\"0\" src=\"/site/images/itlaf.jpg\"></a></td>";
	html	+= "</tr>";
	html	+= "<tr>";
	html	+= "<td >";
	html	+= "</td>";
	/*
	if( document.all.ph_path && document.all.ph_path.value == "1" )	
		html	+= "<td class=\"interactiveTitle\" ><a href=\"http://www.101days.org/\">"
	else
		html	+= "<td class=\"interactiveTitle\" ><a href=\"/site/topics/article.asp?cu_no="+ document.all.cu_no.value+ "&item_no=1548&version=1&template_id=-1&parent_id=-1"+"\">";
		//html	+= "<td class=\"interactiveTitle\" ><a href=\"/xml/topics/advertise.xml?cu_no="+ document.all.cu_no.value +"\">";
	html	+= unescape("%20%u062D%u0645%u0644%u0629%20%u0627%u0644%u0645%u0627%u0626%u0629%20%u064A%u0648%u0645%20%u0648%u064A%u0648%u0645%20%u0644%u062A%u062E%u0641%u064A%u0641%20%u0627%u0644%u062D%u0635%u0627%u0631%20%u0639%u0646%20%u0627%u0644%u0634%u0639%u0628%20%u0627%u0644%u0641%u0644%u0633%u0637%u064A%u0646%u0649%20%u0648%u062F%u0639%u0645%20%u0635%u0645%u0648%u062F%u0647");
	html	+= "</a></td>";
	*/
	html	+= "</tr>";
	
	html	+= "<tr>";
	html	+= "<td><img border=\"0\" src=\"/site/images/spacer.gif\" width=\"18px\">";
	html	+= "</td>";
	html	+= "</tr>";
	html	+= "<tr>";
	html	+= "<td align=\"center\"><a href=\"http://www.ihorizons.com\">"+"<img border=\"0\" src=\"/site/images/horizons-banner2-small.gif\"></a></td>";
	html	+= "</tr>";
	html	+= "</table>";
	if( document.all.adv )
		document.all.adv.innerHTML =  html;
}

function NewsletterBody()
{
	
	if(!(document.all.Newsletter))
		return false ;
		
	var strHTML = "" ;
	
		

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/////   					Send Article By Email					//////////////
/////                			By yahya kateeb 				    //////////		
//////////////////////////////////////////////////////////////////////////////
var SendEmailWindow = null  ;
function SendByEmail()
{
	
	if(SendEmailWindow != null) // if SendEmail was already opened
	{
		SendEmailWindow.focus() ;
		return ;
	}
	// open SendEmail window	
	SendEmailWindow = window.open('/site/Stream/sendByEmail.htm','','width=350; height=260; scrollbars=0');
}
function unloadArtcileWindow()
{
	if(SendEmailWindow)
		if(SendEmailWindow != null) // if SendEmail was already opened
		{
			SendEmailWindow.close() ;
			SendEmailWindow = null ;
		}
}
function openAdvertise()
{ 
	//window.open("/advertise.htm",null,"height=450,width=550,status=yes,toolbar=no,menubar=no,location=no, resizable=yes")	
	//window.open("/xml/topics/advertise.xml?cu_no=" + document.all.cu_no.value,null,"height=450,width=550,status=yes,toolbar=no,menubar=no,location=no, resizable=yes,scrollbars=yes")	
}







