
function switchStyle(style) { 

 var i, a; 
 // no style passed, see if we have a cookie
 if ((style == null) || (!style)) { 
 
 	 // getting current cookie value for the stylesheet   
 	 style = Cookie.get('style');
	 
	 // no cookie so just use the default
	 if((style == null) || (!style)) {
 
		 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {  
				 
			 if(a.getAttribute("rel").indexOf('style') != -1  && a.getAttribute("media").indexOf('screen') != -1 && a.getAttribute("title") ) {
				 
				 if(a.getAttribute("rel").indexOf('alternate style') == -1) {
					   style = a.getAttribute("title"); 
					   //set the default stylesheet as cookie value 
				 }
			 }  
		  }  
	  
	 }
  }  

 Cookie.set('style', style, {duration:365, path: "/"});

 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {  
		 
	 if( (a.getAttribute("rel").indexOf('style') != -1)  && (a.getAttribute("media").indexOf('screen') != -1) && a.getAttribute("title") ) {
		
		//a.disabled = (style == a.getAttribute("title")) ? false : true;  
		a.disabled = true;
		if (a.getAttribute('title') == style) a.disabled = false;
		 
	 }  
  }  
 
 return true;           

}  
window.addEvent('domready', function() { switchStyle(); });  
