/*  This requires JQuery */

var cookieName =  'exbMobileCookie';

function getExbMobileCookie () {
		return $.cookie(cookieName);
}

function setExbMobileCookie(siteType) {
			//acceptable values are 'mobile' and 'desktop'
			$.cookie(cookieName, siteType,{ expires:  30, path: '/'});
}

function switchVersion (inType,inObject) {
    inObject.href="#";
    var relativeStr = $.url.attr("relative");
    var sourceStr = $.url.attr("source");
	var domainStr = sourceStr.substring(0,sourceStr.indexOf(relativeStr));
	setExbMobileCookie(inType);
	if  (inType == 'mobile') {
			window.location  = domainStr + "/m" +  relativeStr;
		} else {  //'desktop'
			window.location = domainStr + relativeStr.substring(2) ;
		}
}
