if(docDate == null)
	var docDate = "";

if(id == null)
	var id = "";

var i=0;


// Mohammed Al-Tobji @ 29-07-2002
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
// Mohammed AL-Tobji @19-09-2002
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 Mohammed Al-Tobji

function veiwDetail(detailId)
{
	//Header = detailId+'H';
	Icon = detailId+'I';
	if (document.all[detailId].className == "")
	{
		document.all[detailId].className = "hide";
		//document.all[Header].className = "category";
		document.all[Icon].src="/site/images/(+)icon.gif";
	}
	else
	{
		document.all[detailId].className = "";
		document.all[Icon].src='/site/images/(-)icon.gif';
	}
	
}

////////////////////////////////////////////////////////
// trim is similar to the Trim fucntion in VBScript   //
//   it uses ltrim(left trim), to eliminate the left  //
//   side spaces, and rtrim(right trim),to eliminate  //
//   the right side spaces.                           //
// Parameters:                                        //
//	IN - strParam : the text input					  //                        
////////////////////////////////////////////////////////

function Trim(strParam)
{
	strParam = LTrim(strParam) ;
	strParam = RTrim(strParam) ;
	return strParam ;
}
// Eliminate all Left Spaces	////////////
function LTrim(strParam)
{
	var c;
	for(var i = 0 ; i < strParam.length ; i++)
	{
		c = strParam.charAt(i) ;
		if( c != " ")
			break ;
	}
	strParam = strParam.substring(i,strParam.length)	 ;
	return strParam ;
}
// Eliminate all Right Spaces	/////////////
function RTrim(strParam)
{	
	var c ;
	for(var i = strParam.length-1 ; i>0 ; i--)
	{
		c = strParam.charAt(i) ;
		if( c != " " )
			break ;
	}
	if(i != strParam.length-1)
		strParam = strParam.substring(0,i+1) ;
	
	return strParam ;
}
/////////////////////////////////////////


function submitSearch()
{
	var cu_no = "1" ;
	if( document.getElementById("cu_no") )
	{
		cu_no = document.getElementById("cu_no").value ; 
	}

	if( document.getElementById("searchText") != null  )
	{
		document.getElementById("searchText").value = Trim(document.getElementById("searchText").value) ;
	
		
			if( document.getElementById("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")) ;
				document.getElementById("searchText").focus() ;

			}
			else
			{
				var  hrefVal ;
				hrefVal = "/site/topics/AdvSearchResult.asp?cu_no="+ cu_no +"&text=" + escape(document.getElementById("searchText").value) ;
				window.location.href= hrefVal ;
			}
		
	}
	

}

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()
{

}

//email
function openSendByEmailPage()
{
	window.open("/sendByEmail.htm",null,"height=250,width=450,status=yes,toolbar=no,menubar=no,location=no, resizable=yes")	
}



function NewsletterBody()
{
	
	if(!(document.all.Newsletter))
		return false ;
		
	var strHTML = "" ;
	
		

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/////					Send Article By Email					//////////////
/////			By Mohammed Al-Tobji @12-08-2002				//////////////		
//////////////////////////////////////////////////////////////////////////////
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','_blank','height=280, width=350,left=300, top=290, scrollbars=0, location=no, menubar=no, status=no, toolbar=no, resizable=no ');
	
	
}
function unloadArtcileWindow()
{
	if(SendEmailWindow)
		if(SendEmailWindow != null) // if SendEmail was already opened
		{
			SendEmailWindow.close() ;
			SendEmailWindow = null ;
		}
}







