/*--------------------------------------------------------------------				 
Ex :
Alternate Stylesheets :
------------------------------------------------------------------------*/

function MakeGreen() {
	var currentStyle = "";
    document.getElementById('cssFile').setAttribute('href', '/Style Library/ar-sa/green.css');
    currentStyle = "/Style Library/ar-sa/green.css";
    setCookie("currentStyleS", currentStyle);
}
function MakePinky() {
	var currentStyle = "";
    document.getElementById('cssFile').setAttribute('href', '/Style Library/ar-sa/Orang.css');
    currentStyle = "/Style Library/ar-sa/Orang.css";
    setCookie("currentStyleS", currentStyle);
}
function MakeDefault() {
	var currentStyle = "";
    document.getElementById('cssFile').setAttribute('href', '/Style Library/ar-sa/GDefault.css');
    currentStyle = "/Style Library/ar-sa/GDefault.css";
    setCookie("currentStyleS", currentStyle);
}
function MakeBlue() {
	var currentStyle = "";
    document.getElementById('cssFile').setAttribute('href', '/Style Library/ar-sa/bleu.css');
    currentStyle = "/Style Library/ar-sa/bleu.css";
    setCookie("currentStyleS", currentStyle);
}
function MakeTSmall() {
	/*  */
	var currentStyle1 = "";
    document.getElementById('FontcssFile').setAttribute('href', '/Style Library/ar-sa/smalltext.css');
    currentStyle1 = "/Style Library/ar-sa/smalltext.css";
    setCookie("current-font-StyleS", currentStyle1);
  
}
function MakeTMedium() {
/*  */ 
	var currentStyle1 = "";
    document.getElementById('FontcssFile').setAttribute('href', '/Style Library/ar-sa/medtext.css');
    currentStyle1 = "/Style Library/ar-sa/medtext.css";
    setCookie("current-font-StyleS", currentStyle1);

}
function MakeTBig() {
/* */
	var currentStyle1 = "";
    document.getElementById('FontcssFile').setAttribute('href', '/Style Library/ar-sa/bigtext.css');
    currentStyle1 = "/Style Library/ar-sa/bigtext.css";
    setCookie("current-font-StyleS", currentStyle1);
   
}

function ChangeImage2(controlID,imageURL)
{
	document.getElementById('orangImage').setAttribute('src', '/Style Library/Images/Orang.png');
	document.getElementById('DefaultImage').setAttribute('src', '/Style Library/Images/GDefault.png');
	document.getElementById('bleuImage').setAttribute('src', '/Style Library/Images/bleu.png');
	document.getElementById('greenImage').setAttribute('src', '/Style Library/Images/green.png');

	document.getElementById(controlID).setAttribute('src', imageURL);

}

function ChangeImage(controlID,imageURL)
{
	document.getElementById('BigImage').setAttribute('src', '/Style Library/Images/MOF-A-B.png');
	document.getElementById('MediumImage').setAttribute('src', '/Style Library/Images/MOF-A-M.png');
	document.getElementById('SmallImage').setAttribute('src', '/Style Library/Images/MOF-A-S.png');
	
	document.getElementById(controlID).setAttribute('src', imageURL);
}
function checkCookie() {
	//alert("checkCookie");
    var currentStyle = "";
    var myCookie = getCookie('currentStyleS');
    if (myCookie == null || myCookie == "")
    {    
				    /* for fonts */
				    var currentStylef = "";
				    var myCookief = getCookie('current-font-StyleS');
				    if (myCookief == null || myCookief == "")
				    {
				        currentStylef = "/Style Library/ar-sa/medtext.css";
				        document.getElementById('FontcssFile').setAttribute('href',currentStylef);						
				        setCookie("current-font-StyleS", currentStylef);
				        //alert("F00");
				    }
				    else
				    {
			    	   currentStylef = getCookie('current-font-StyleS');
 					   document.getElementById('FontcssFile').setAttribute('href',currentStylef);				
 					   //alert("F11");
				    }
/* for fonts */
    
        currentStyle = "/Style Library/ar-sa/GDefault.css";
        document.getElementById('cssFile').setAttribute('href',currentStyle);
		ChangeImage2('DefaultImage','/Style Library/Images/GDefault-C.png')
        setCookie("currentStyleS", currentStyle);
        //alert("3");
    }
    else
     {    	
    	/* for fonts */
		var currentStylef = "";
	    var myCookief = getCookie('current-font-StyleS');
	    if (myCookief == null || myCookief == "")
	    {
	        currentStylef = "/Style Library/ar-sa/medtext.css";
	        document.getElementById('FontcssFile').setAttribute('href',currentStylef);
	        setCookie("current-font-StyleS", currentStylef);
	        //alert("F0");
	    }
	    else
	    {
			currentStylef = getCookie('current-font-StyleS');
			document.getElementById('FontcssFile').setAttribute('href',currentStylef);
			//alert("F1");
	    }
/* for fonts */
    	
    	//currentStyle=myCookie;
        //currentStyle = getCookie('currentStyleS');
        //alert("Here");
        //alert(document.getElementById('cssFile'));
        currentStyle = myCookie;
        if (currentStyle != "/Style Library/ar-sa/color3.css")
        document.getElementById('cssFile').setAttribute('href', currentStyle);
        
        switch (currentStyle)
		{
			case "/Style Library/ar-sa/GDefault.css":
				ChangeImage2('DefaultImage','/Style Library/Images/GDefault-C.png')
				break;
			case "/Style Library/ar-sa/Orang.css":
				ChangeImage2('orangImage','/Style Library/Images/Orang-C.png')
				break;
			case "/Style Library/ar-sa/bleu.css":
				ChangeImage2('bleuImage','/Style Library/Images/bleu-C.png')				
				break;
			case "/Style Library/ar-sa/green.css":				
				ChangeImage2('greenImage','/Style Library/Images/green-C.png')
				break;	
			default:
				  ChangeImage2('DefaultImage','/Style Library/Images/GDefault-C.png')
		}
        //alert(currentStyle);
    }
}

function setCookie(name, YouEntered) {
    //document.cookie=name+"="+YouEntered+"; expires=Monday, 04-Apr-2300 05:00:00 GMT; path=/";
    document.cookie = name + "=" + YouEntered + "; expires=Monday, 04-Apr-2300 05:00:00 GMT; path=/ ;";
    //document.cookie="username="+YouEntered+"; expires=Monday, 04-Apr-2300 05:00:00 GMT; path=/"
}

function getCookie(c_name) {
//alert("getCookie");
    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;
          	}
          	//alert(unescape(document.cookie.substring(c_start, c_end)));  
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return ""
}


