// JavaScript Document

function checkStatus(table){

	var myTable = document.getElementById(table);

	var thisCSS = getCSSClass(".style_"+table);

	var thisCSSImage = getCSSClass(".styleImage_"+table);

	var thisCSSTable = getCSSClass(".styleTable_"+table);

	

	if(thisCSS.style.display == "none"){		

		showTable(thisCSS, thisCSSImage, thisCSSTable);

		setCookie(thisSection+"_"+table, "1");

	}else{

		hideTable(thisCSS, thisCSSImage, thisCSSTable);

		setCookie(thisSection+"_"+table, "0");

	}

}

function getCSSClass(className){

	if(document.styleSheets[0].rules){//IE

		var thisStylesheet = document.styleSheets[0].rules;

	}else{//FIREFOX

		var thisStylesheet = document.styleSheets[0].cssRules;

	}

	

	for(var i=0;i<thisStylesheet.length;i++){

		if(thisStylesheet[i].selectorText == className){

			

			return thisStylesheet[i];

		}

	}

	

}

function hideTable(thisCSS, thisCSSImage, thisCSSTable){

	thisCSS.style.display = "none";

	thisCSSImage.style.backgroundImage = "url('../images/sm_arrowLeft.gif')";

	thisCSSTable.style.color = "#3B3B3D";

	//document.getElementById("arrow_"+tableName).src = "../images/sm_arrowLeft.gif";

}

function showTable(thisCSS, thisCSSImage, thisCSSTable){

	thisCSS.style.display = "block";

	thisCSSImage.style.backgroundImage = "url('../images/sm_arrowDown.gif')";

	thisCSSTable.style.color = "#105AA3";

	//document.getElementById("arrow_"+tableName).src = "../images/sm_arrowDown.gif";

}



function changeColorOver(thisObject, id, hasSM){

	

	if(hasSM){

		

		var thisCSS = getCSSClass(".style_sm_"+id);

		

		if(thisSousSection != id && thisCSS.style.display == "none"){ 

			thisObject.style.color = '#105AA3';

			thisObject.style.textDecorationUnderline; 

		}

		

	}else{

		

		if(thisSousSection != id){

			thisObject.style.color = '#105AA3';

			thisObject.style.textDecorationUnderline; 

		}

		

	}

	

}



function changeColorOut(thisObject, id, hasSM){

	

	if(hasSM){

		

		var thisCSS = getCSSClass(".style_sm_"+id);

		

		if(thisSousSection != id && thisCSS.style.display == "none"){ 

			thisObject.style.color = '#3B3B3D';

			thisObject.style.textDecorationNone; 

		}

		

	} else {

		

		if(thisSousSection != id){

			thisObject.style.color = '#3B3B3D';

			thisObject.style.textDecorationUnderline; 

		}

		

	}

	

}



/* COOKIES */



function setCookie(name, value, expires, path, domain, secure)

{

    document.cookie= name + "=" + escape(value) +

        ((expires) ? "; expires=" + expires.toGMTString() : "") +

        ((path) ? "; path=" + path : "") +

        ((domain) ? "; domain=" + domain : "") +

        ((secure) ? "; secure" : "");

}



function getCookie(name)

{

    var dc = document.cookie;

    var prefix = name + "=";

    var begin = dc.indexOf("; " + prefix);

    if (begin == -1)

    {

        begin = dc.indexOf(prefix);

        if (begin != 0) return null;

    }

    else

    {

        begin += 2;

    }

    var end = document.cookie.indexOf(";", begin);

    if (end == -1)

    {

        end = dc.length;

    }

    return unescape(dc.substring(begin + prefix.length, end));

}
