var omniture_toi = 'omniture_toi';
var omniture_skin = 'omniture_skin';
var omniture_myprofile = 'omniture_myprofile';
var omniture_carprofile = 'omniture_carprofile';

function getAndDeleteCookie(name){
if (!name){return false;}
var value = getCook(name);
if (!value) { return false;}
delCook(name);
return value;
}

function getTopicOfInterestCookie(){
return getAndDeleteCookie(omniture_toi);
}

function setTopicOfInterestCookie(){
var elm = jQuery("input:checked").val();
if(!elm) return false;
setCook(omniture_toi, elm);
}

function getSkinCookie(){
return getAndDeleteCookie(omniture_skin);
}

function setSkinCookie(){
var elm = jQuery("input:checked").val();
if(!elm) return false;
setCook(omniture_skin, elm);
}

function getMyProfileCookie(){
return getAndDeleteCookie(omniture_myprofile);
}

function setMyProfileCookie(){
setCook(omniture_myprofile, 'validatemyprofile');
}

function getCarProfileCookie(){
return getAndDeleteCookie(omniture_carprofile);
}

function setCarProfileValideCookie(){
setCook(omniture_carprofile, 'validatemycar');
}

function setCarProfileEditCookie(){
setCook(omniture_carprofile, 'editmycar');
}

function getUrlParameter( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
	return "";
else
	return results[1];
}

function getUnsubTagging(){
var currentPage = getUrlParameter('unsubscribeId');
if ("confirm" == currentPage ){
	return "step2confirmaccountdeletion";
}
return "step1warningandreasons";
}

function getDeleteMyCarTagging(){
	var currentPage = getUrlParameter('deleteId');
	if ("confirm" == currentPage ){
		return "cardeletionstep2";
	}
	return "cardeletionstep1";
}

function getUrlParameterBluetooth( name ){
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return "home";
	else
		return results[1];
	}

