function checkstyleSmall(){
   setActiveStyleSheet('Smallstyle'); 
   return false;
}

function checkstyleMedium(){
   setActiveStyleSheet('Medstyle'); 
   return false;
}

function checkstyleLarge(){
   setActiveStyleSheet('Largestyle'); 
   return false;
}

function submitTAF()
{
  document.TAF.submit();
}

function initTAF(){

	if(document.TAF	!= null){
		document.TAF.title.value=document.title;
		document.TAF.Referer.value=document.URL;	
		}

}
function initTAFTwo()
{
	if(document.TAF	!= null){
	document.TAF.title.value="Tykerb.com"+" Home";
	var dd = document.domain;
	document.TAF.Referer.value="http://"+dd + "/index.html";
	}	
}
function setActiveStyleSheet(title) {
  var i, a, main;
  createCookie("style", title, 365);
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";

}

function readCookie(name) {
  var nameEQ = name + "=";
  //alert(name);
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) 
		//alert(c.substring(nameEQ.length,c.length));
		return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {

//var cookie = readCookie("style");
//var title = cookie ? cookie : getPreferredStyleSheet();
//setActiveStyleSheet(title);
if(readCookie("style"))
{
	var cookie = readCookie("style");
}
else
{
	var cookie ="Medstyle";
}

//alert("one "+cookie);

	var is_q = document.URL.indexOf('?p=');
	// check the ? is there

	if (is_q == -1)
	{ 
		if (cookie.length > 4 && cookie != "PrintMe")
		{
			var title = cookie;
		}
		else if (cookie.length > 4 && cookie == "Smallstyle")
		{
			var title = "Smallstyle";
		}
		else if (cookie.length > 4 && cookie == "Largestyle")
		{
			var title = "Largestyle";
		}
	
	}
	else if (is_q > 0)
	{
		var title = "PrintMe";
		 createCookie("style", title, 365);
	}


	
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}


//var cookie = readCookie("style");
//var title = cookie ? cookie : getPreferredStyleSheet();
//setActiveStyleSheet(title);
if(readCookie("style"))
{
	var cookie = readCookie("style");
}
else
{
	var cookie ="Medstyle";
}
//alert("two "+cookie);
	var is_q = document.URL.indexOf('?p=');
	// check the ? is there

	if (is_q == -1)
	{ 
		if (cookie.length > 4 && cookie != "PrintMe")
		{
			var title = cookie;
		}
		else if (cookie.length > 4 && cookie == "Smallstyle")
		{
			var title = "Smallstyle"+this_folder;
		}
		else if (cookie.length > 4 && cookie == "Largestyle")
		{
			var title = "Largestyle"+this_folder;
		}
	
	}
	else if (is_q > 0)
	{
		var title = "PrintMe";
		 createCookie("style", title, 365);
	}
	
if (title==null || title=="undefined"){
	title="Medstyle";
	
	}
 setActiveStyleSheet(title);
