var arrCSS=[
    ["<img src='/img/w.gif' class='themes' alt='White'>","w_css"],
    ["<img src='/img/b.gif' class='themes' alt='Blue'>","blue_css"],
	["<img src='/img/c.gif' class='themes' alt='Grey'>","c_css"],
	[]
];

// *** function to replace href="#" ***
function v(){
	window.location.reload();
	return;
}

// *** Cookies ***
function writeCookie(name, value){ 
	exp = new Date(); 
	exp.setTime(exp.getTime() + (86400 * 1000 * 30));
	document.cookie = name + "=" + escape(value) + "; expires=" + exp.toGMTString() + "; path=/"; 
} 

function readCookie(name){ 
	var search; 
	search = name + "="; 
	offset = document.cookie.indexOf(search); 
	if (offset != -1) { 
		offset += search.length; 
		end = document.cookie.indexOf(";", offset); 
		if (end == -1){
			end = document.cookie.length;
		}
		return unescape(document.cookie.substring(offset, end)); 
	}else{
		return "";
	}
}


////////////////////////////////////
// StyleSheet
////////////////////////////////////

function writeCSSLinks(){
  for(var i=0;i<arrCSS.length-1;i++){
    if(i>0) document.write('  ');
     document.write('<a href="javascript:v()" onclick="setStyleSheet(\''+arrCSS[i][1]+'\')">'+arrCSS[i][0]+'</a>');
  }
}

function iframeCSSLinks(){
  for(var i=0;i<arrCSS.length-1;i++){
    if(i>0) document.write('  ');
     document.write('<a href="javascript:parent.location.reload();" onclick="setStyleSheet(\''+arrCSS[i][1]+'\')">'+arrCSS[i][0]+'</a>');
  }
}


function setStyleSheet(strCSS){
  writeCookie("stylesheet",strCSS);
}

function CssPath(){
   css =  readCookie("stylesheet")
   if (css == '') { return arrCSS[0][1];}
   else
   	 return css;
}

function show_sub(index){
    var i ;
    for (i=1;i<=3;i++){        
        document.getElementById('main_nav_'+i).className="";
        document.getElementById('sub_nav_'+i).style.display="none";
    }
    document.getElementById('main_nav_'+index).className="here"; 
    document.getElementById('sub_nav_'+index).style.display="block";    
}

function open_box_show(){
 document.getElementById("menu-ddcontent").style.display="block";
}
function open_box_close(){
 document.getElementById("menu-ddcontent").style.display="none";
}