$(document).ready(function() {
	try{
		var $tabs = $('#bizLines > ul').tabs({cookie: {expires: 30} });
		$tabs.tabs('select',readIt('ppkcookie2'));
	}catch(err){}

});

function CookieTab(tabIndex) {
	//First erase the cookie value if there is a cookie
	eraseIt('ppkcookie2');
	
	//Re create the cookie
	saveIt('ppkcookie2', tabIndex,7);
	
	//Read the cookie and get the values
	readIt('ppkcookie2');
}



function saveIt(name,val,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	
	document.cookie = name+"="+val+expires+"; path=/";
   //alert('Cookie created');
}

function readIt(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));

}

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 eraseIt(name) {
	//Cookies.erase(name);
	document.cookie = name+"="+""+7+"; path=/";
	//alert('Cookie erased');
}


function init() {
	for (var i=1;i<3;i++) {
		var x = Cookies['ppkcookie' + i];
		if (x) alert('Cookie ppkcookie' + i + '\nthat you set on a previous visit, is still active.\nIts value is ' + x);
	}
}