var menuwidth='165px' //default menu width
var menubgcolor='whitesmoke'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?
/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')


function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-50px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")+5
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
//if (ie4||ns6) return false
//else 
return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

//======================================================set homepage==================================
function firefoxAlert() 
{
if(navigator.appName!="Microsoft Internet Explorer" && navigator.appName!="Netscape")
{
alert("From the browser menu,Select Tools->Preferences->General tab's Home Page entry box, type http://www.lexpress.mu/ and click OK");
}else{
alert('To set Lexpress as your home page in Firefox, click and drag the button to the "Home" icon in your browser.');
}
return false;
}
function setHome() 
{
if(navigator.appName!="Microsoft Internet Explorer" && navigator.appName!="Netscape")
{
alert("From the browser menu,Select Preferences->General tab's Home Page entry box, type http://www.lexpress.mu/ and click OK");
}else{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage("http://www.lexpress.mu/");
}
return false;
}

//================================================subscribe page=========================
function CheckNumeric()
{
   // Get ASCII value of key that user pressed
   var key = window.event.keyCode;

   // Was key that was pressed a numeric character (0-9)?
   if ( key >= 65 && key < 122 || key == 32)
      return; // if so, do nothing
   else
      window.event.returnValue = null; // otherwise, 
	                               // discard character
}


function funchk()
{
    if (document.Form1.name.value=="")
    {
     alert("Please Enter Your Name")
     document.Form1.name.focus();
     return false;
    }
    else if (document.Form1.name.value!="")
    {
       if(document.Form1.email.value=="")
       {
            alert("E-mail est un champ obligatoire")
            document.Form1.email.focus();
            return false;
       }
       else if(document.Form1.email.value!="")
       {
           if (document.Form1.feedbackarea.value=="")
           {
               alert("Please Enter Your FeedBack")
               document.Form1.feedbackarea.focus();
               return false;
           }
       }

    }
    else
    {
        return true;
    }

}
		function echeck(str)
		 {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Vous avez indiqué une adresse e-mail invalide");
		   return false;
		}

		else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Vous avez indiqué une adresse e-mail invalide");
		   return false;
		}

		else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Vous avez indiqué une adresse e-mail invalide");
		    return false;
		}

		else if (str.indexOf(at,(lat+1))!=-1){
		    alert("Vous avez indiqué une adresse e-mail invalide");
		    return false;
		 }

		else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Vous avez indiqué une adresse e-mail invalide");
		    return false;
		 }

		else if (str.indexOf(dot,(lat+2))==-1){
		    alert("Vous avez indiqué une adresse e-mail invalide");
		    return false;
		 }
		
		else if (str.indexOf(" ")!=-1){
		    alert("Vous avez indiqué une adresse e-mail invalide");
		    return false;
		 }
		else
		{
 		 return true;
 		}
	}

function ValidateForm(t)
{
	var emailID=t
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("E-mail est un champ obligatoire")
		emailID.focus()
		return false
	}
	else if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	else
	{
//	document.Form1.title.value="";
//	document.Form1.fname.value="";
//	document.Form1.lname.value="";
//	document.Form1.email.value="";
//	document.Form1.phone.value="";
//	document.Form1.TEXTAREA1.value="";
//	document.Form1.post.value="";
//	document.Form1.country.value="";
//	alert("Subscription Successfull!")
	return true
	}
 }
		
		
		function subc()
		{
		var subname=document.Form1.Name.value;
		var mailval=document.Form1.mailid.value;
		document.Form1.sub.text=subname;
		document.Form1.comment.text=mailval;
		if(document.Form1.comment.text=="")
		{
		alert("E-mail est un champ obligatoire")
		}
		else
		{
		alert("Thanks For Your Feedback")
		}
		}
		
		function rich()
		{
		
		var varmail=document.Form1.email.value;
		document.Form1.mailid1.text=varmail;
		}
		
		function sendtip()
		{
		var tips=document.Form1.tip.value;
		if(document.Form1.tip.value=="")
		{
		alert("Please Enter The Tips");
		}
		else
		{
		alert("Thanks For Your Tips")
		}
		}
		function fun1()
		{
		var tips=document.Form1.tip.value;
		}
	   function funsend()
	   {
	   var tips=document.Form1.tip.value;
	   document.Form1.comment.text=tips;
	   
	   if(document.Form1.comment.text=="")
	   {
	   alert("Please enter the Feedback")
	   }
	   else
	   {
	   alert("Thanks for your Feedback ")
	   }
       }
       
		function validateforint(obj,event)
        {
        var keyCode=event.keyCode?event.keyCode:event.which?event.which:event.charCode;
        if ((keyCode>=48 && keyCode<=57))
        return true;
        else
        return false;
        }
		
		
		
		function validate()
		{
	        if(document.Form1.title.value=="")
	        {
	            alert("Vous devez entrer une civilité");
	        }
	        else if(document.Form1.fname.value=="")
	        {
	            alert("Prénom est un champ obligatoire");
	        }
	    }
		
		
       
       		
		function chkfun()
		{
	
		if(document.Form1.TEXTAREA1.value=="")
		{
		alert("Please Enter The Tips")
		}
		else
		{
		alert("Thank You")
		}
		}
//==================================================end============================

//=====================archives==============



function update_Click(gallid)
{
    //alert(gallid);
    PageMethods.upd_count(gallid,onSucceeded,onFailed);
    return true;
}
function onFailed(error)
{
    //alert(error);
    return false;
}

function onSucceeded(result)
{ 
    //alert(result);
    return false;
}


//=========================================topbaar..for w3c
function nullvalue()
{
	document.getElementById('Topbar1_txtsearch').value='';
	document.getElementById('Topbar1_txtsearch').style.color='#000000';
}

function setvalue()
{
	if(document.getElementById('Topbar1_txtsearch').value=='')
	{
		document.getElementById('Topbar1_txtsearch').value='I Am Looking For...';
		document.getElementById('Topbar1_txtsearch').style.color='gray';
	}
}
function opensign()
{
document.getElementById('Topbar1_divsign').style.display="Block";
}
function getalert()
{
alert('Thanks for using Lexpress');
document.getElementById('Topbar1_Button1').click();
}

function hidediv_new()
{
    document.getElementById('Topbar1_divsign').style.display="None";
}
if (screen.width == 1024)
{ 
    document.write('<link href="../stylesheet/1024desktop.css" type="text/css" rel="stylesheet" />'); 
}

if(screen.width == 1280)
{
    document.write('<link href="../stylesheet/1280laptop.css" type="text/css" rel="stylesheet" />'); 
}

//===========edited for w3c//interview=============
var trInt=1;
function storyplusInt()
{
    if(document.getElementById('Intid'+trInt)!=null && trInt <= 5)
    {
        document.getElementById('Intid'+trInt).style.display="";
        trInt=parseInt(trInt) + 1;
        //alert(trid);
    }
    return false;
}
function storyminusInt()
{
    if(trInt > 1)
    {
        trInt=parseInt(trInt) - 1;
        if(document.getElementById('Intid'+trInt)!=null)
        {
            document.getElementById('Intid'+trInt).style.display="none";
            //alert(trid);        
        }
    }
    return false;
}
//=====================forums===
var trFid=1;
function storyplusForum()
{
    if(document.getElementById('Fid'+trFid)!=null && trFid <= 5)
    {
        document.getElementById('Fid'+trFid).style.display="";
        trFid=parseInt(trFid) + 1;
        //alert(trid);
    }
    return false;
}
function storyminusForum()
{
    if(trFid > 1)
    {
        trFid=parseInt(trFid) - 1;
        if(document.getElementById('Fid'+trFid)!=null)
        {
            document.getElementById('Fid'+trFid).style.display="none";
            //alert(trid);        
        }
    }
    return false;
}

//======================humour===========
function changePic(picsrc,btnid,caption)
{
    document.getElementById("imgHumour").src=picsrc;    
    for(var i=1; i<=5; i++)
    {
       if("img"+i==btnid)
       {
        document.getElementById(btnid).src="images/"+i+"_h.jpg";
       }
       else
       {
        document.getElementById("img"+i).src="images/"+i+".jpg";
       }
       caption=caption.replace("^","'");
       document.getElementById('tdHead').innerHTML=caption;
    }
}
