var dom = document.domain;

function getCookie(theName){
	theName += "=";
	theCookie = document.cookie + ";";
	start = theCookie.indexOf(theName);
	if(start != -1)
	{
		end = theCookie.indexOf(";", start);
		return unescape(theCookie.substring(start + theName.length, end));
	}
	return("");
}

function setCookie(theName,theValue){
	if((theName != null) && (theValue != null)){
		theCookie = theName + "=" + escape(theValue) + ";path=/;";
		if(dom != ""){
			theCookie += "domain=" + dom + ";";
		}
		document.cookie = theCookie;
		return true;
	}
	return false;
}

function delCookie(theName){
	theCookie = theName + "=;";
	theCookie += "expires=Thu, 01-Jan-1970 00:00:01 GMT;";
	theCookie += "path=/;";
	if(dom != ""){
		theCookie += "domain=" + dom + ";";
	}
	document.cookie = theCookie;
	return true;
}

var IE = (navigator.appName.indexOf("Explorer") != -1);
function autoPlay(flag){
	if(getCookie('PLAY')){
		if(flag&&getCookie('MEDIA')=='SDJB'){
			SdjbExecuter(playURL[getCookie('MEDIA')])
		}else if(Mac&&IE){
			location.href=playURL[getCookie('MEDIA')];
		}else{
			wmp=window.open("","wmp");
			wmp.location.href=playURL[getCookie('MEDIA')];
		}
		delCookie('PLAY');
		delCookie('MEDIA');
	}
}
