
function MakeRed()
{
    document.getElementById('cssFile').setAttribute('href', '/Skins/Classic/Style/InstantASP.Common.UI.Red.css');
    currentStyle = "/PortalCSS/mawheba_Red.css";
    setCookie("currentStyleS", currentStyle);
}
function MakeBlue()
{
    document.getElementById('cssFile').setAttribute('href', '/Skins/Classic/Style/InstantASP.Common.UI.css');
    currentStyle = "/PortalCSS/Mawheba_mainStyle.css";
     setCookie("currentStyleS", currentStyle);
}
function MakeGreen()
{
    document.getElementById('cssFile').setAttribute('href', '/Skins/Classic/Style/InstantASP.Common.UI.Green.css');
    currentStyle = "/PortalCSS/mawheba_green.css";
    setCookie("currentStyleS", currentStyle);
}
function MakeYellow()
{
    document.getElementById('cssFile').setAttribute('href', '/Skins/Classic/Style/InstantASP.Common.UI.Yellow.css');
    currentStyle = "/PortalCSS/mawheba_yellow.css";
    setCookie("currentStyleS", currentStyle);
}
function MakePurple()
{
    document.getElementById('cssFile').setAttribute('href', '/Skins/Classic/Style/InstantASP.Common.UI.Purple.css');
    currentStyle = "/PortalCSS/mawheba_purple.css";
     setCookie("currentStyleS", currentStyle);
}


function checkCookie()
{
    var currentStyle="";
    var myCookie = getCookie('currentStyleS');
    if(myCookie == null || myCookie == "") {
         currentStyle = "/Skins/Classic/Style/InstantASP.Common.UI.css";
         document.getElementById('cssFile').setAttribute('href', currentStyle);
         currentStyle = "/PortalCSS/Mawheba_mainStyle.css";   
         setCookie("currentStyleS", currentStyle);
    }
    else {
        currentStyle = getCookie('currentStyleS');
        switch (currentStyle) {
            case "/PortalCSS/mawheba_Red.css":
                currentStyle2 = "/Skins/Classic/Style/InstantASP.Common.UI.Red.css";
                break;
            case "/PortalCSS/mawheba_green.css":
                currentStyle2 = "/Skins/Classic/Style/InstantASP.Common.UI.Green.css";
                break;
            case "/PortalCSS/mawheba_yellow.css":
                currentStyle2 = "/Skins/Classic/Style/InstantASP.Common.UI.Yellow.css";
                break;
            case "/PortalCSS/mawheba_purple.css":
                currentStyle2 = "/Skins/Classic/Style/InstantASP.Common.UI.Purple.css";
                break;
            default:
                currentStyle2 = "/Skins/Classic/Style/InstantASP.Common.UI.css";
                break;
        }
		//alert(currentStyle);
        document.getElementById('cssFile').setAttribute('href',currentStyle2);
		//alert(getCookie('username'));
    }
    updatemainheaderflash(currentStyle)

}

function getCookie(c_name)
{
  if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
 
   }
  }
 return ""
} 
function setCookie(name, YouEntered) {
    document.cookie = "currentStyleS=" + YouEntered + ";expires=Monday, 04-Apr-2300 05:00:00 GMT;path=/;domain=.mawhiba.org";
    //document.cookie = "username=" + YouEntered + "; expires=Monday, 04-Apr-2300 05:00:00 GMT; path=/ ; domain=.mawhiba.org"
	updatemainheaderflash(YouEntered);
}
function HatemcreateCookie(name,value,days) 
{
	if (days) 
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/MAWHWBA";
}

