//use this file for js 

//generic pop up
function launchUpload(loc,w,h){
	var id = Math.round(Math.random()*1000);
	var numW = Number(w);
	var numH = Number(h);
	window.open(loc, id,"width="+numW+", height="+numH+", left=100, top=100, scrollbars=auto, toolbar=no, location=no, status=no, menubar=no, resizable=yes");
}

function simpleTrack (sID) {
//	alert('simpletrack');
//	urchinTracker("funtime/" + sID);

}

function popUpAndTrack (sUrl, sID) {

//	urchinTracker("/" + cid + "-funtime-" + sID);
	
	setTimeout("getURL('" + sUrl + "')", 1000);

}


function getURL(sUrl){
	
	document.location = sUrl;
	
}




function pageJump(){
	window.scrollTo(0, 0);
}

/* HIDES NON FLASH ELEMENTS TO ALLOW FLASH TO LOAD FIRST */
function trickReplacement1 (){
   myDiv = document.getElementById("suggestions");
   var t=setTimeout("myDiv.style.visibility = 'visible';",1000);
}

function trickReplacement2 (){
   myDiv1 = document.getElementById("rightpanel");
   var t=setTimeout("myDiv1.style.visibility = 'visible';",1000);
}

function trickReplacement3 (){
   myDiv2 = document.getElementById("logo");
   var t=setTimeout("myDiv2.style.visibility = 'visible';",1000);
}

function trickReplacement4 (){
   myDiv4 = document.getElementById("trailer");
   var t=setTimeout("myDiv4.style.visibility = 'visible';",1000);
}



function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function popupPayment(URL,w,h) {
	LeftPosition= (screen.width *0.5)-(w*0.5);
	TopPosition=(screen.height *0.5)-(h*0.5);                   
		window.open(URL,'popup','width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');     
}

function popup(URL) {
	myWidth = 400;
	myHeight = 380;

	LeftPosition= (screen.width *0.5)-(myWidth*0.5);
	TopPosition=(screen.height *0.5)-(myHeight*0.5);                   
	window.open(URL,'popup','width='+myWidth+',height='+myHeight+',top='+TopPosition+',left='+LeftPosition+',scrollbars=auto,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');     
}

function popup_dynamic(URL,w,h,wName,scroll){

	if(scroll == null){
		scroll = "auto";
	}
	
	if(w == null){
		myWidth = screen.width - (screen.width * 0.1);
		myHeight = screen.height - (screen.height* 0.1);
	}else{
		myWidth = w;
		myHeight = h;
	}

	LeftPosition= (screen.width *0.5)-(myWidth*0.5);
	TopPosition=(screen.height *0.5)-(myHeight*0.5);                   
	window.open(URL,wName,'width='+myWidth+',height='+myHeight+',top='+TopPosition+',left='+LeftPosition+',scrollbars=' + scroll + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes');     

}

function popup_fun(URL,w,h,wName){
	
	if(w == null){
		myWidth = screen.width - (screen.width * 0.1);
		myHeight = screen.height - (screen.height* 0.1);
	}else{
		myWidth = w;
		myHeight = h;
	}

	LeftPosition= (screen.width *0.5)-(myWidth*0.5);
	TopPosition=(screen.height *0.5)-(myHeight*0.5);                   
	window.open(URL,wName,'width='+myWidth+',height='+myHeight+',top='+TopPosition+',left='+LeftPosition+',scrollbars=1,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes');     

}

function popupFooters(URL) {

		myWidth = 500;
		myHeight = 380;

	LeftPosition= (screen.width *0.5)-(myWidth*0.5);
	TopPosition=(screen.height *0.5)-(myHeight*0.5);                   
		window.open(URL,'popup','width='+myWidth+',height='+myHeight+',top='+TopPosition+',left='+LeftPosition+',scrollbars=auto,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');     
}

function QueryString_Parse()
{
	var query = unescape(window.location.search.substring(1) );
    
	var pairs = query.split("&");
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}
}

QueryString_Parse();

var country = unescape(QueryString("country") );
if (country == "null"){
    country = "uk";
}

var section = unescape(QueryString("section") );
var subSection = unescape(QueryString("subSection") );
if (section == "null"){
    section = "init";
}

var preview = unescape(QueryString("preview") );
if (preview == "cms"){
	previewVar = "cms";
}else{
	previewVar = '';
}

var isbookmark = "false";

function bookmark(url,title){

alert('bookmark')
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  		window.external.AddFavorite(window.location,"Noddy.com");
  	}else if (navigator.appName == "Netscape") {
    	window.sidebar.addPanel("Noddy.com",window.location,"");
  	}
}

if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
	isbookmark = "true";
}

function loginToNoddy(country){
	
	switch(country) {
		
		case "uk":
			window.parent.location = "http://uk.noddy.com/site/join/mydetails.php?after=musicmakeruk";
			break;
		case "us":
			window.parent.location = "http://us.noddy.com/site/join/mydetails.php?after=musicmakerus";
			break;
			
	}
}

function signupToNoddy(country){
	
	switch(country) {
		
		case "uk":
			window.parent.location = "http://uk.noddy.com/site/join/register.php?after=musicmakeruk";
			break;
		case "us":
			window.parent.location = "http://us.noddy.com/site/join/register.php?after=musicmakerus";
			break;
			
	}
}

function linkWithinNoddy(url){
	
	window.parent.location = url;
}
	

