function changeto(highlightcolor){source=event.srcElement if (source.tagName=="TR"||source.tagName=="TABLE")return while(source.tagName!="TD")source=source.parentElement if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")source.style.backgroundColor=highlightcolor}function changeback(originalcolor){if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")return if (event.toElement!=source)source.style.backgroundColor=originalcolor}
startList = function(){ if(!document.body.currentStyle) return; var subs = document.getElementsByName('subitem'); for(var i=0; i<subs.length; i++) { var li = subs[i].parentNode; if(li && li.lastChild.style){li.onmouseover = function(){ this.lastChild.style.visibility = 'visible';}li.onmouseout = function(){this.lastChild.style.visibility = 'hidden';}}}}window.onload=startList;
function newWindow(mypage,myname,w,h,features) {  if(screen.width){  var winl = (screen.width-w)/2;  var wint = (screen.height-h)/2;  }else{winl = 0;wint =0;}  if (winl < 0) winl = 0;  if (wint < 0) wint = 0;  var settings = 'height=' + h + ',';  settings += 'width=' + w + ',';  settings += 'top=' + wint + ',';  settings += 'left=' + winl + ',';  settings += features;  win = window.open(mypage,myname,settings);  win.window.focus();}
function Favorite(){if(document.all){ window.external.AddFavorite(window.document.location,window.document.title);}}
///used by counsel program only
function go(theURL) {   
document.location.href=theURL;
} 
////
function navBar( tableCellRef, hoverFlag, navStyle ,bgcolor ) {   

	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = bgcolor;
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
				}
		}
	} else {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = bgcolor;
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
				}
		}
	}
}

function ShowHideFrontpagelements() 
		{
			var OldStyle = tblFrontpagelements.style.display;
			
			if (OldStyle == "") 
			{
				tblFrontpagelements.style.display = "none";
				document.getElementById('imgfrontpgelement').src = "template/Front-End/images/icons/fromnews-expand.gif";
			}
			else
			{
				tblFrontpagelements.style.display = "";
				document.getElementById('imgfrontpgelement').src = "template/Front-End/images/icons/fromnews-collapse.gif";
			}
			return false;
		}


function chg_formaction() {
         var section_id;  
       
	section_id=document.srch_form.sectionid.options[document.srch_form.sectionid.selectedIndex].value;
        
        if(document.srch_form.searchword.value=="") 
        {
        	alert('ارجو اختيار كلمة البحث');
        	return false;	
        }
        	
       
        
	if(section_id==1 || section_id==-1)
		document.srch_form.action='index.php'; 
	else if(section_id==2)
		document.srch_form.action='index-counsels.php'; 
	else if(section_id==3)
		document.srch_form.action='index-babies.php';  
	else	
		document.srch_form.action='index.php'; 
	 			
	}
	 	
function go_searchadv() {
        
         
	 section_id=document.srch_form.sectionid.options[document.srch_form.sectionid.selectedIndex].value;
	 
	 if(section_id==-1)
	    window.location.href='index.php?option=content&section=search&task=srchadv_gnrl';
	 else if(section_id==1)
	    window.location.href='index.php?option=content&section=search&task=srchadv&sectionid=1';
	 else if(section_id==2)
	    window.location.href='index-counsels.php?option=content&section=search&task=srchadv&sectionid=2'; 
	 else if(section_id==3)
	    window.location.href='index-babies.php?option=content&section=search&task=srchadv&sectionid=3';  
	 else
	    window.location.href='index.php?option=content&section=search&task=srchadv&sectionid=1';    
}