/////////////////////////////////////////////////////////////////////////////////
//     PreferenceChanger.js
//			Used as an interface into the CookieObject to setCookies as the user
//			changes his/her preferences.
//
/////////////////////////////////////////////////////////////////////////////////
function getCookie(name){
	var c = document.cookie;
		if (c.indexOf(name)==-1) {
			 return null;
		} else {
			var start = c.indexOf(name)+name.length+1;
			for (var end = start; end < c.length; end++) if (c.charAt(end)==";") break;
		    return unescape(c.substring(start,end));
	}
}	

function setCookie(name, value) {
	var exp = new Date();
	var twoYears = exp.getTime() + (730 * 24 * 60 * 60 * 1000);
	exp.setTime(twoYears);
	document.cookie = name + "=" + escape(value) + "; expires=" + exp.toGMTString() + "; path=/;";
}

// function used to set the conn cookie value
	function setConn(value) {
		if (value != 'dummy') {
		    if (getCookie('conn') != value) {
				setCookie('conn', value);
				location.href = 'http://cgi.cbs.com:8000/apps/video/pageOne.html?videoimage=' + getCookie('videoimage') + '&fc=' + getCookie('fc') + '&bc=' + getCookie('bc') + '&sec=' + getCookie('sec') + '&title=' + getCookie('title');
			}
		}
	}
	
// function used to set the playerType cookie value
	function setPlayer(value) {
		if (value != 'dummy') {
			if (getCookie('PlayerType') != value) {
				setCookie('PlayerType', value); 
				location.href = 'http://cgi.cbs.com:8000/apps/video/pageOne.html?videoimage=' + getCookie('videoimage') + '&fc=' + getCookie('fc') + '&bc=' + getCookie('bc') + '&sec=' + getCookie('sec') + '&title=' + getCookie('title');
			}
		}
	}
	

	
	
