function checkDate(yr,mo,dt) {
	var mo=mo-1;
	var today=new Date();
	var userDateAt = location.search.substring().indexOf("today=");
	if (userDateAt > 0) {
		var userDateStr = location.search.substr(userDateAt+6);
		var userDateEnd =  userDateStr.indexOf("&");
		if (userDateEnd > 0) {
			userDateStr = userDateStr.substring (0,userDateEnd);
		}
		userDate = userDateStr.split(",");
		today.setFullYear(userDate[0]);
		today.setMonth(Number(userDate[1])-1);
		today.setDate(userDate[2]);
	}
	today.setMinutes(today.getMinutes()+10);
	var streetDate = new Date();
	streetDate.setFullYear(yr);
	streetDate.setMonth(mo);
	streetDate.setDate(dt);
	if(today >= streetDate) {
		return true;
	}else{
		return false;
	}
}

// BTS Theatrical
function popScrollingWindow(url, width, height, windowName) {
	//get center coords
	var left = (screen.width-width)/2;
	var top = (screen.height-height)/2;
	btsPop = window.open(url,windowName,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height+',left='+left+',top='+top);
	btsPop.window.focus();
}
function loadPage(url) {
	document.location.href=url;
}
function loadinparent(url, closeSelf){
	self.opener.location = url;
	if(closeSelf) self.close();
}
function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i = 0; i<vars.length; i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	}
}
function order800() {
	var w = 390;
	var h = 270;
	var winl = (screen.width - w) / 3;
	var wint = (screen.height - h) / 3;
	coords = 'width='+w+',height='+h+',top='+wint+',left='+winl;
	var order800Win = window.open('http://disneydvd.disney.go.com/managed/calltoorder.html','orderwin', coords,'scrollbars=no,resizable=no');
	order800Win.window.focus();
}

function pop(sID,id, size) {
	var trackID = "";
	var theURL = "";
	if (sID == "avatars") {
		var sID = "signatures";
		var id = 0;
	}
	switch (sID) {
		case "game":
			trackID = "section_platformgame"
			theURL = "game/";
			openWindow(theURL,780,550);
		break;
		case "icons":
			trackID = "section_downloads_icons"
			theURL = cid + "/icons.html";
			openWindow(theURL,420,500);
			// popUpAndTrack(trackID,theURL,380,450);
		break;
		case "signatures":
			trackID = "section_downloads_signatures";
			// var id = pop.arguments [1]
			theURL = cid + "/signatures.html?id=" +(id+1);
			openWindow(theURL,420,500);
			// popUpAndTrack(trackID,theURL,380,450);
		break;
		case "wallpaper":
			if (size == 800) {
				var size="sm";
			} else if (size == 1024) {
				var size="md";
			} else {
				var size="hd";
			}
			theURL = cid + '/wallpaper.html?id=' +id + '&size=' +size;
			// trackID = "section_downloads_wallpaper_" + id + "_" + width + "x" + height;
			openWindow(theURL,720,480);
			// popUpAndTrack(trackID, theURL, newWidth, newHeight);
		break;
	}
}

function simpleTrack (sID) {
	// disney tracking code
	_hbflash(sID,'n','n','n');
}

function popUpAndTrack (sID, sURL, nWidth, nHeight, sType) {
	setTimeout("openWindow('" + sURL + "','" + nWidth + "','" + nHeight + "','" + sType + "')", 1000);
	simpleTrack(sID);
}

function openWindow(sUrl, nWidth, nHeight, sType){
	// and the opening of the link
	if(sType == "self"){
		document.location = sUrl;
	} else if (nWidth && nHeight) {
		btsPop = window.open(sUrl,"bts_window",'scrollbars=1,resizable=1,width=' + nWidth + ',height=' + nHeight + '');
		btsPop.window.focus();
	} else {
		btsPop = window.open(sUrl,"bts_window");
		btsPop.window.focus();
	}
}

function mailtoAndTrack (sID, sBody, sSubject) {
	// and the opening of the mail window
	document.location = "mailto:?body=" + sBody + "&subject=" + sSubject;
	simpleTrack(sID);
}
