function readCookie(name){
	var nameEQ = 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) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function text_size(whichWay){
	var size = readCookie('pdp_text_size');
		if (whichWay == "up"){
			size++;
		}
		if(whichWay == "down"){
			size--;
		}

	document.cookie =
	  'pdp_text_size='+size+'; expires=Thu, 2 Aug 2021 20:47:11 UTC; path=/';
	var sURL = unescape(window.location.pathname);
	window.location.replace( sURL );
}

var mobile_check = function(){
	var agent=navigator.userAgent.toLowerCase();
	var is_iphone = (agent.indexOf('iphone')!=-1);
	if (is_iphone) { 
		window.location.replace( "http://dev3.pdpworks.com/mobile/" );
	}
}

$(document).ready(function() {
	var size = readCookie('pdp_text_size');
	//var mobile = mobile_check();
	if (size >= 3){
		$('li#textSizeUp').hide("slow");
	}else if (size <= -3){
		$('#textSizeDown').hide("slow");
	}else{
		$('#textSizeDown').show();
		
	}
});


var enter_key = function(){
	alert(window.event.keyCode);
}

var show = function(show, hide){
	$('#home_page_'+hide+'_image').slideToggle("slow",function(){
		$('#home_page_'+show+'_image').slideToggle("slow");
	});
}


var change_language = function(){
	var language = $('#language').val();
	$.get("/about/change_language/"+language, function(transactions){
			if (transactions == 1){
			var sURL = unescape(window.location.pathname);
			window.location.replace( sURL );
		}	
	});
}


//document.onkeydown = enter_key;
