// URL to access content ticket service ALSO: change line 128 ref for contact_form 
var contentticketurl="../../../portal/content/";
//SHM: Used in function openBarneyCWTPopup to determine if a popup window exists.
var barneyCWTPopupWindow = null;

//SHM: Was used to open a new window and place focus on it:  NOW it opens the requested content in the same window
function linkout_press(pagetype,type){
	//SHM 8/4/2k4: Removed popup from next line
	_hbPageView('press+link[' + type + ']' ,'/barney/us/popups');
	window.open(contentticketurl+"index.asp?pagetype=" + pagetype + "&link=" + type + "","_self");
}

//SHM: Was used to open a new Contact Us window and place focus on it:  NOW it opens the Contact Us content in the same window
function linkout_contactus(){
	contact_form();
}

// Open Barney Fanclub Popup
function linkout_fanclub(){
	_hbPageView('barney+fanclub','/barney/us/popups');
	popup(contentticketurl+"barney_fanclub.asp","presspopup",750,600);
}

// Open Ticket
function open_ticket(ticketid,sLocal){
	if(sLocal == ''){
		sLocal = "us";
	}
	_hbPageView('open+ticket[' + ticketid + ']','/barney/' + sLocal + '/popups');
	popup(contentticketurl+"?ticketid="+ticketid,"presspopup",750,550,"scrollbars");
}

// Open Menu for Ticket Type
function open_menu(brand,country,tickettype,subtickettype){
	var PageHit = subtickettype ? tickettype + '+' + subtickettype + '+' + country + '+' + brand : tickettype + '+' + country + '+' + brand
		_hbPageView(PageHit, '/barney/' + country + '/popups');
	var extra=(subtickettype) ? "&sub="+escape(subtickettype) : "";
	popup(contentticketurl+"?brand="+brand+"&country="+country+"&menu="+tickettype+extra,"presspopup",750,550,"scrollbars");
}

// Open Latest Ticket for Ticket Type
function open_latest(brand,country,tickettype,subtickettype){
	var PageHit = subtickettype ? tickettype + '+' + subtickettype + '+' + country + '+' + brand : tickettype + '+' + country + '+' + brand
		_hbPageView(PageHit, '/barney/' + country + '/popups');
	var extra=(subtickettype) ? "&sub="+escape(subtickettype) : "";
	popup(contentticketurl+"?brand="+brand+"&country="+country+"&latest="+tickettype+extra,"presspopup",750,550,"scrollbars");
}

// Changes Background Colour
function changebg(tocolour){
	document.body.style.backgroundColor=tocolour;
}

// View Wallpaper
function wallpaper(image,local){
	//SHM 8/4/2k4: Removed popup from next line
	//getURL("javascript:LoadContent('?c=us&L3=make_area.swf&NF=empty&CL=" + _level0.HColor + "','make+area','/Barney/us/playroom')");
	_hbPageView(image,'/barney/' + local + '/kids+menu/make+menu/wallpaper+downloads');
	window.open("../wallpapers/viewer.asp?image=" + image,"_self");
}

// Popup Window (Centred)
function popup(url,winname,w,h,feat){
	//SHM 8/4/2k4: Removed popup from next line
	//alert(url);
	window.open(url,"_self");
}

//Function to open The Contact Form
function contact_form(){
	open_popup("contact_form");
}

//Function to open the registration form
function registration_form(){
	open_popup("registration");
}

//SHM: Was used to open a new window and place focus on it:  NOW it opens the requested content in the same window
function open_popup(pagename){
	//SHM 8/4/2k4: Removed popup from next line
	if (pagename=="contact_form") {
		var dotpath = "../../../portal/";
	} else {
		var dotpath = "../../../";
	}
	window.open(dotpath + pagename + "/","_self");
}

//SHM: Was used to open a new Barney Tour window and place focus on it:  NOW it does nothing 
// Remove all but the first comment line HIDE marks ("//") to reenable the code to execute
function openBarneyCWTPopup() {
	//SHM 8/4/2k4: Removed popup from next line *********************************
	//if ( barneyCWTPopupWindow ) barneyCWTPopupWindow.close();
	//w = 600;
	//h = 430;
	//x = (screen.availWidth - w)/ 2;
	//y = (screen.availHeight - h) / 2;
	//var style='resizable=no,status=no,width=' + w + ',height=' + h + ',top=' + y + ',left=' + x;
	//barneyCWTPopupWindow = window.open('http://www.hitentertainment.com/barney/uk/colourfulworldtour/index.html','BarneyPopup',style);
}
//SHM: 8/5/2k4: Next Function accepts parameters for both registering a hit on HitBox and Loading the next movie
function LoadContent(sURL,pn,mlc){
	//RECORD HIT AND NAVIGATE:
	//	VAR DEFINITIONS:	sURL= URL to Navigate to; pn=Page Name; mlc= Multi-Level Content
	//  ActionScript Call Example: getURL("javascript:LoadContent('?c=us&L3=play_area.swf&NF=empty&CL=" + _level0.HColor + "','play+area','/Barney/Dev/us/playroom/play+area')");
	//EXCHANGE "/Barney/virtualfolder" with "/Barney/DEV/virtualfolder"
	//mlc = mlc.replace(/barney/i,"Barney/DEV")
	mlc = mlc.replace(/\/USA\//ig,"/us/")
	//LOAD UP HITBOX HIT
	if(pn != "" && mlc != ""){
			_hbPageView(pn,mlc);
	}
	//LOAD UP NAVIGATED LOCATION
	window.open(sURL,'_self');
}

//SHM: 8/5/2k4: Next two Functions Used for Debug Determining the current content on layers 30,40 displayed in the "_level0" movie
function ShowLayers(sLayerThree,sLayerFour,sLocal){
		alert("Layer Three: " + sLayerThree);
		alert("Layer Four: " + sLayerFour);
		alert("Location: " + sLocal);
}

//function Message(sMessage){
//		alert(sMessage);
//}