function getUtstDogData(id, type, regnr, page, showid, district) {
	if (document.getElementById("dogDisplay_" + id).style.visibility == "visible") {
	 document.getElementById("dogDisplay_" + id).style.visibility = "hidden";
	 document.getElementById("dogDisplay_" + id).style.height = "0px";
	} else {
		xmlhttp = GetXmlHttpObject();
		if (xmlhttp == null) {
  			alert ("Din webbläsare stödjer inte HTTP Requests. Var god uppdatera din webbläsare.");
  			return;
  		}
		var url="php/smp/getUtstDogData.php";
		url = url + "?regnr=" + regnr;
		url = url + "&type=" + type;
		url = url + "&p=" + page;
		url = url + "&showid=" + showid;
		url = url + "&district=" + district;
		xmlhttp.onreadystatechange = stateChanged;	
		xmlhttp.open("GET", url, false);
		xmlhttp.send(null);
		document.getElementById("dogDisplay_" + id).style.visibility = "visible";
		document.getElementById("dogDisplay_" + id).style.height = "auto";
		document.getElementById("dogDisplay_" + id).innerHTML = xmlhttp.responseText;
	}
}


function hideDiv(divID) { 
	if (document.getElementById) 
		document.getElementById(divID).style.visibility = 'hidden'; 
	else 
		if (document.layers) 
		document.divID.visibility = 'hidden'; 
		else 
			document.all.divID.style.visibility = 'hidden';
}

function showDiv(divID) { 
	if (document.getElementById) 
		document.getElementById(divID).style.visibility = 'visible'; 
	else
		if (document.layers)
			document.divID.visibility = 'visible'; 
		else 
			document.all.divID.style.visibility = 'visible';
} 

function Set_Cookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function setFather(regnr) {	
	Set_Cookie('breedStud', regnr);
	document.breedForm.breedStud.value = regnr;
}

function setMother(regnr) {	
	Set_Cookie('breedBitch', regnr);
	document.breedForm.breedBitch.value = regnr;
}

function Get_Cookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false;
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		a_temp_cookie = a_all_cookies[i].split( '=' );
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			if ( a_temp_cookie.length > 1 ) { cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); }
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function addToBasket(prodID) {
	if (prodID) {
		cookie_value = Get_Cookie("slkShop");
		
		if (storlek = document.getElementById(prodID).value)
			size	= storlek;
		else if (storlek = document.getElementName(prodID).value)
			size	= storlek;
		else if (storlek = document.prodID.value)
			size	= storlek;			
		else
			size  = '0';
			
		if (cookie_value)
			Set_Cookie("slkShop", cookie_value+'-'+prodID+'_'+size, "", "", "slk.nu", "" )
		else
			Set_Cookie("slkShop", prodID+'_'+size, "", "", "slk.nu", "" )
	}
}

function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
		( ( path ) ? ";path=" + path : "") +
		( ( domain ) ? ";domain=" + domain : "" ) +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function resetFontSize() {
	Delete_Cookie( 'fontSize', '', 'slk.nu' );
	window.location.reload();
}

function setFontSize() {
	if ( Get_Cookie( 'fontSize' ) ) {
		var p = document.getElementsByName('mainPageContent');
   	for(i=0;i<p.length;i++) {
      	if(p[i].style.fontSize) {
         	var s = parseInt(p[i].style.fontSize.replace("px",""));
      	} else {
         	var s = Get_Cookie( 'fontSize' );
      	}
      	if(s!=min) {
         	s -= 1;
      	}
      	p[i].style.fontSize = Get_Cookie( 'fontSize' );
   	} 
	} 
}

function changeFontSize(inc) {
	var p = document.getElementsByName('mainPageContent');
	for(n=0; n<p.length; n++) {
	  	if(p[n].style.fontSize) {
  	  		var size = parseInt(p[n].style.fontSize.replace("px", ""));
   	} else {
     		var size = 12;
   	}
   	p[n].style.fontSize = size+inc + 'px';
   	Set_Cookie("fontSize", size+inc + 'px', "", "", "slk.nu", "" )
  	}
}
