// Standard Dreamweaver functions
function MM_swapImgRestore() 
{
	var i, x, a = document.MM_sr; 
	for (i = 0; a&&i < a.length&&(x=a[i])&&x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) 
{
  	var p, i, x;  
	if (!d) d = document; 
	if ((p=n.indexOf("?")) > 0&&parent.frames.length) 
	{
    	d = parent.frames[n.substring(p+1)].document; 
		n = n.substring(0,p);
	}
  	if (!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0; !x&&i < d.forms.length; i++) x=d.forms[i][n];
  	for (i=0; !x&&d.layers&&i < d.layers.length; i++) x = MM_findObj(n,d.layers[i].document);
  	if (!x && d.getElementById) x = d.getElementById(n); 
	return x;
}

function MM_swapImage() 
{
	var i, j=0, x, a = MM_swapImage.arguments; 
	document.MM_sr = new Array; 
	for (i=0; i < (a.length-2); i+=3)
   	if ((x=MM_findObj(a[i]))!=null)
	{
		document.MM_sr[j++] = x; 
		if (!x.oSrc) x.oSrc = x.src; x.src = a[i+2];
	}
}

function MM_preloadImages() 
{
	var d=document; 
	if(d.images)
	{
		if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    	if(a[i].indexOf("#")!=0)
		{
			d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
		}
	}
}

function MM_jumpMenu(targ,selObj,restore)
{
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) 
{
	var p,i,x;  
	if (!d) d=document; 
	if ((p=n.indexOf("?")) > 0&&parent.frames.length) 
	{
   		d = parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
  	if (!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0; !x&&i < d.forms.length; i++) x = d.forms[i][n];
  	for (i=0; !x&&d.layers&&i < d.layers.length; i++) x = MM_findObj(n,d.layers[i].document);
  	if (!x && document.getElementById) x=document.getElementById(n); 
	return x;
}

function MM_showHideLayers() 
{
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
	if ((obj=MM_findObj(args[i]))!=null) 
  	{ 
		v=args[i+2];
		if (obj.style) 
		{ 
			obj=obj.style; 
			v=(v=='show')?'visible':(v='hide')?'hidden':v; 
		}
		obj.visibility=v; 
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function openNewWindow(URLtoOpen, windowName, windowFeatures) 
{ 
	if (newWindow) newWindow.close(); 
	newWindow=window.open(URLtoOpen, windowName, windowFeatures); 
} 

function openNewWindow(URLtoOpen, windowName, windowFeatures) 
{ 
	newWindow=window.open(URLtoOpen, windowName, windowFeatures); 
	newWindow.focus(); 
}

function MM_openBrWindow(theURL,winName,features) 
{
	window.open(theURL,winName,features);
}

function MM_popupMsg(msg) 
{
	alert(msg);
}

strBaseURL	= 'www.dance2.co.uk';
var isNS4;
var isNS6;
var isIE4;
var isIE5;
var strPlatform;

isNS4 		= (document.layers) ? true : false;
isIE4 		= (document.all && !document.getElementById) ? true : false;
isIE5 		= (document.all && document.getElementById) ? true : false;
isNS6 		= (!document.all && document.getElementById) ? true : false;

Browser 	= navigator.appName
Net 		= Browser.indexOf("Netscape")
Micro 		= Browser.indexOf("Microsoft")
Netscape 	= false
IE 			= false

if(Net >= 0) 
{
	Netscape = true
}

if(Micro >= 0) i
{
	IE = true
}

var xPos;
var yPos;
document.onmousemove = XYpos;

var updateRequest = createMultiRequest();

function createRequest()
{
	try
	{
		request = new XMLHttpRequest();
	}
	catch (trymicrosoft)
	{
		try
		{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (othermicrosoft)
		{
			try
			{
				request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed)
			{
				request = null;
			}
		}
	}

	if(request == null)
	{
		alert("Error creating request object");
	}

	return request;
}

function createMultiRequest()
{
	try
	{
		request = new XMLHttpRequest();
	}
	catch (trymicrosoft)
	{
		try
		{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (othermicrosoft)
		{
			try
			{
				request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed)
			{
				request = null;
			}
		}
	}
 
	if(request == null)
	{
		alert("Error creating request object");
	}
 
	return request;
}

function XYpos(event) 
{
	if (IE == true) 
	{
		xPos = event.screenX
		yPos = event.screenY
	}
	else
	{
		xPos = e.clientX;
		yPos = e.clientY;
	}
	
	yPos = document.documentElement.scrollTop + yPos;
}

function getMouseXY(event) 
{
	if (IE) 
	{ // grab the x-y pos.s if browser is IE
		xPos = event.clientX + document.body.scrollLeft
		yPos = event.clientY + document.body.scrollTop
	} 
	else
	{  // grab the x-y pos.s if browser is NS
		xPos = e.pageX
		yPos = e.pageY
	}  
	// catch possible negative values in NS4
	if (xPos < 0){xPos = 0}
	if (yPos < 0){yPos = 0}  
  
  	return true
}

function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft
		curtop 	= obj.offsetTop
		while (obj = obj.offsetParent) 
		{
			curleft += obj.offsetLeft
			curtop 	+= obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function is_int(strValue)
{
	var i;

	if (isEmpty(strValue.value))
	{
		return 'empty';
	}

	for (iCount = 0; iCount < strValue.value.length; iCount++)
	{
		var strThisChar = strValue.value.charAt(iCount);

		if (!isDigit(strThisChar))
		{
			return false;
		}
	}
	
	return true;
}

function isEmpty(strValue)
{
	return ((strValue == null) || (strValue.length == 0))
}

function isDigit(iValue)
{
	return ((iValue >= "0") && (iValue <= "9"))
}

function changeActionDiv(strContent, strVisibleStatus, leftPos, topPos)
{
	hActionDiv 					= document.getElementById("actionDiv");
	hActionDiv.innerHTML		= strContent;
	hActionDiv.style.visibility	= strVisibleStatus;
	hActionDiv.style.top		= topPos + 'px';
	hActionDiv.style.left		= leftPos + 'px';
}

function showActionLayer(iLeft, iTop, iWidth, iHeight)
{
	hALayer						= document.getElementById("actionLayer");
	hALayer.style.background	= '#FFFFFF';
	hALayer.style.visibility	= 'visible';
	hALayer.style.left			= iLeft + 'px';
	hALayer.style.top			= iTop + 'px';
	hALayer.style.width			= iWidth + 'px';
	hALayer.style.height		= iHeight + 'px';
}

function hideActionLayer()
{
	hALayer 					= document.getElementById("actionLayer");
	hALayer.style.visibility	= 'hidden';
}

function hideActionDiv()
{
//	if(IE)
//	{
//		upload					= document.getElementById("actionLayer");
//		upload.style.visibility	= 'hidden';
//	}

	handle 						= document.getElementById("actionDiv");
	handle.style.visibility 	= "hidden";
}

function getCheckedValue(radioObj) 
{
	if(!radioObj)	return "";
	
	var radioLength = radioObj.length;
	
	if(radioLength == undefined)
	{
		if(radioObj.checked)
		{
			return radioObj.value;
		}
		else
		{
			return "";
		}
	}
	
	for(var i = 0; i < radioLength; i++) 
	{
		if(radioObj[i].checked) 
		{
			alert(radioObj[i].value);
			return radioObj[i].value;
		}
	}
	return "";
}



// Records Admin
function getNewRecordImageForm(iRecordID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/records/jsnewimage.php?iRecordID=' + iRecordID + '&dummy=' + new Date().getTime();

	record = createRequest();
	record.open("GET", strURL, true);
	record.onreadystatechange = showNewRecordImageForm;
	record.send(null);
}


function showNewRecordImageForm()
{
	if(record.readyState == 4)
	{
		strContent	=	record.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}


function getNewRecordAudioForm(iRecordID, iAudioID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/records/jsnewaudio.php?iRecordID=' + iRecordID + '&iAudioID=' + iAudioID + '&dummy=' + new Date().getTime();

	record = createRequest();
	record.open("GET", strURL, true);
	record.onreadystatechange = showNewRecordAudioForm;
	record.send(null);
}


function showNewRecordAudioForm()
{
	if(record.readyState == 4)
	{
		strContent	=	record.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}



// DJ Kit Admin
function getNewDJKitVideoForm(iDJKitID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/djkit/jsnewvideodjkit.php?iDJKitID=' + iDJKitID + '&dummy=' + new Date().getTime();

	djkit = createRequest();
	djkit.open("GET", strURL, true);
	djkit.onreadystatechange = showNewDJKitVideoForm;
	djkit.send(null);
}


function showNewDJKitVideoForm()
{
	if(djkit.readyState == 4)
	{
		strContent	=	djkit.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}


function getNewDJKitImageForm(iDJKitID, iImageID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/djkit/jsnewimagedjkit.php?iDJKitID=' + iDJKitID + '&iImageID=' + iImageID + '&dummy=' + new Date().getTime();

	djkit = createRequest();
	djkit.open("GET", strURL, true);
	djkit.onreadystatechange = showNewDJKitImageForm;
	djkit.send(null);
}


function showNewDJKitImageForm()
{
	if(djkit.readyState == 4)
	{
		strContent	=	djkit.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}



// Disco Kit Admin
function getNewDiscoVideoForm(iDiscoID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/djkit/jsnewvideodisco.php?iDiscoID=' + iDiscoID + '&dummy=' + new Date().getTime();

	disco = createRequest();
	disco.open("GET", strURL, true);
	disco.onreadystatechange = showNewDiscoVideoForm;
	disco.send(null);
}


function showNewDiscoVideoForm()
{
	if(disco.readyState == 4)
	{
		strContent	=	disco.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}


function getNewDiscoImageForm(iDiscoID, iImageID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/djkit/jsnewimagedisco.php?iDiscoID=' + iDiscoID + '&iImageID=' + iImageID + '&dummy=' + new Date().getTime();

	disco = createRequest();
	disco.open("GET", strURL, true);
	disco.onreadystatechange = showNewDiscoImageForm;
	disco.send(null);
}


function showNewDiscoImageForm()
{
	if(disco.readyState == 4)
	{
		strContent	=	disco.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}



// Hire Admin
function getNewHireVideoForm(iHireID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/hire/jsnewvideo.php?iHireID=' + iHireID + '&dummy=' + new Date().getTime();

	hire = createRequest();
	hire.open("GET", strURL, true);
	hire.onreadystatechange = showNewHireVideoForm;
	hire.send(null);
}


function showNewHireVideoForm()
{
	if(hire.readyState == 4)
	{
		strContent	=	hire.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}


function getNewHireImageForm(iHireID, iImageID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/hire/jsnewimage.php?iHireID=' + iHireID + '&iImageID=' + iImageID + '&dummy=' + new Date().getTime();

	hire = createRequest();
	hire.open("GET", strURL, true);
	hire.onreadystatechange = showNewHireImageForm;
	hire.send(null);
}


function showNewHireImageForm()
{
	if(hire.readyState == 4)
	{
		strContent	=	hire.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}



// DJ Ent Admin
function getNewDJImageForm(iProfileID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/djent/jsnewdjimage.php?iProfileID=' + iProfileID + '&dummy=' + new Date().getTime();

	dj = createRequest();
	dj.open("GET", strURL, true);
	dj.onreadystatechange = showNewDJImageForm;
	dj.send(null);
}


function showNewDJImageForm()
{
	if(dj.readyState == 4)
	{
		strContent	=	dj.responseText;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}


function getNewClientImageForm(iClientID)
{
	var strURL	= 'http://' + strBaseURL + '/admin/djent/jsnewclientimage.php?iClientID=' + iClientID + '&dummy=' + new Date().getTime();

	client = createRequest();
	client.open("GET", strURL, true);
	client.onreadystatechange = showNewClientImageForm;
	client.send(null);
}


function showNewClientImageForm()
{
	if(client.readyState == 4)
	{
		strContent	=	client.responseText;
		alert(xPos);
		xPos = 300;
		yPos = 300;
		
		changeActionDiv(strContent, 'visible', xPos - 150, yPos - 75);
	}
}



// Disco Kit Front
function getNewDiscoKitImage(iDiscoID, iImage)
{
	var strURL	= 'http://' + strBaseURL + '/djstore/jsshowimagedisco.php?iDiscoID=' + iDiscoID + '&iImage=' + iImage + '&dummy=' + new Date().getTime();
	
	disco = createRequest();
	disco.open("GET", strURL, true);
	disco.onreadystatechange = showNewDiscoKitImage;
	disco.send(null);
}


function showNewDiscoKitImage()
{
	if(disco.readyState == 4)
	{
		handle = document.getElementById("imageSpan");
		handle.innerHTML = disco.responseText;
	}
}



// Front Functions
function getNewImage(iItemID, iImage, strTable)
{
	var strURL	= 'http://' + strBaseURL + '/js/showimage.php?iItemID=' + iItemID + '&iImage=' + iImage + '&strTable=' + strTable + '&dummy=' + new Date().getTime();
	
	image = createRequest();
	image.open("GET", strURL, true);
	image.onreadystatechange = showNewImage;
	image.send(null);
}


function showNewImage()
{
	if(image.readyState == 4)
	{
		handle = document.getElementById("imageSpan");
		handle.innerHTML = image.responseText;
	}
}


function showVideo(strPath)
{
	strContent	=	"<p><embed src='/videos/player/player.swf' width='640' height='360' bgcolor='undefined' allowscriptaccess='always' allowfullscreen='true' flashvars='file=http://" + strBaseURL + strPath + "&backcolor=000000&frontcolor=FF0000&lightcolor=FFFFFF&screencolor=000000&controlbar=over&stretching=exactfit'/><br><a href=\"javascript:hidePlayer()\" class=\"light\">close</a></p>";

	// Get the window dimensions and if the page has scrolled
	var iWindowWidth = 0
	var iWindowHeight = 0;
	var iScrollX = 0
	var iScrollY = 0;
	if(typeof( window.innerWidth ) == 'number')
	{
		//Non-IE
		iWindowWidth	=	window.innerWidth;
		iWindowHeight	=	window.innerHeight;
		iScrollY		=	window.pageYOffset;
		iScrollX		=	window.pageXOffset;
	} 
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		iWindowWidth	=	document.documentElement.clientWidth;
		iWindowHeight	=	document.documentElement.clientHeight;
		iScrollY		= 	document.documentElement.scrollTop;
		iScrollX		= 	document.documentElement.scrollLeft;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		//IE 4 compatible
		iWindowWidth	=	document.body.clientWidth;
		iWindowHeight	=	document.body.clientHeight;
		iScrollY		= 	document.body.scrollTop;
		iScrollX		= 	document.body.scrollLeft;
	}
	
	// Make the semi-trasparent background visible
	hActionDiv 					= document.getElementById("actionDiv");
	hActionDiv.style.visibility	= 'visible';
	hActionDiv.style.top		= iScrollY + 'px';
	hActionDiv.style.left		= '0px';
	hActionDiv.style.width		= iWindowWidth + 'px';
	hActionDiv.style.height		= iWindowHeight + 'px';
	
	// Where is the video going?
	iVideoTop	=	((iWindowHeight / 2) - 250) + iScrollY;
	iVideoLeft	=	(iWindowWidth / 2) - 300;
	
	// Make the foreground visible
	hActionDiv 					= document.getElementById("actionDivFore");
	hActionDiv.innerHTML		= strContent;
	hActionDiv.style.visibility	= 'visible';
	hActionDiv.style.top		= iVideoTop + 'px';
	hActionDiv.style.left		= iVideoLeft + 'px';
	hActionDiv.style.width		= '100%';
	hActionDiv.style.height		= '300px';
	hActionDiv.style.textAlign	= 'center';

}


function playAudio(strPath)
{
	strContent	=	"<p><embed src='/videos/player/player.swf' width='640' height='100' bgcolor='undefined' allowscriptaccess='always' allowfullscreen='false' flashvars='file=http://" + strBaseURL + strPath + "&backcolor=000000&frontcolor=FF0000&lightcolor=FFFFFF&screencolor=000000&controlbar=under&stretching=exactfit'/><br><a href=\"javascript:hidePlayer()\" class=\"light\">close</a></p>";

	// Get the window dimensions and if the page has scrolled
	var iWindowWidth = 0
	var iWindowHeight = 0;
	var iScrollX = 0
	var iScrollY = 0;
	if(typeof( window.innerWidth ) == 'number')
	{
		//Non-IE
		iWindowWidth	=	window.innerWidth;
		iWindowHeight	=	window.innerHeight;
		iScrollY		=	window.pageYOffset;
		iScrollX		=	window.pageXOffset;
	} 
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		iWindowWidth	=	document.documentElement.clientWidth;
		iWindowHeight	=	document.documentElement.clientHeight;
		iScrollY		= 	document.documentElement.scrollTop;
		iScrollX		= 	document.documentElement.scrollLeft;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		//IE 4 compatible
		iWindowWidth	=	document.body.clientWidth;
		iWindowHeight	=	document.body.clientHeight;
		iScrollY		= 	document.body.scrollTop;
		iScrollX		= 	document.body.scrollLeft;
	}
	
	// Make the semi-trasparent background visible
	hActionDiv 					= document.getElementById("actionDiv");
	hActionDiv.style.visibility	= 'visible';
	hActionDiv.style.top		= iScrollY + 'px';
	hActionDiv.style.left		= '0px';
	hActionDiv.style.width		= iWindowWidth + 'px';
	hActionDiv.style.height		= iWindowHeight + 'px';
	
	// Where is the video going?
	iVideoTop	=	((iWindowHeight / 2) - 100) + iScrollY;
	iVideoLeft	=	(iWindowWidth / 2) - 300;
	
	// Make the foreground visible
	hActionDiv 					= document.getElementById("actionDivFore");
	hActionDiv.innerHTML		= strContent;
	hActionDiv.style.visibility	= 'visible';
	hActionDiv.style.top		= iVideoTop + 'px';
	hActionDiv.style.left		= iVideoLeft + 'px';
	hActionDiv.style.height		= '300px';

}


function hidePlayer()
{
	hActionDiv 						= document.getElementById("actionDiv");
	hActionDiv.style.visibility		= 'hidden';
	hActionDivFore					= document.getElementById("actionDivFore");
	hActionDivFore.style.visibility	= 'hidden';
	hActionDivFore.innerHTML		= '';
}


function showFullImage(strPath, iWidth, iHeight)
{
	strContent	=	"<p><img src=\"http://" + strBaseURL + strPath + "\" width=\"" + iWidth + "\" height=\"" + iHeight + "\" border=\"0\"/><br><a href=\"javascript:hidePlayer()\" class=\"light\">close</a></p>";

	// Get the window dimensions and if the page has scrolled
	var iWindowWidth = 0
	var iWindowHeight = 0;
	var iScrollX = 0
	var iScrollY = 0;
	if(typeof( window.innerWidth ) == 'number')
	{
		//Non-IE
		iWindowWidth	=	window.innerWidth;
		iWindowHeight	=	window.innerHeight;
		iScrollY		=	window.pageYOffset;
		iScrollX		=	window.pageXOffset;
	} 
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		iWindowWidth	=	document.documentElement.clientWidth;
		iWindowHeight	=	document.documentElement.clientHeight;
		iScrollY		= 	document.documentElement.scrollTop;
		iScrollX		= 	document.documentElement.scrollLeft;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		//IE 4 compatible
		iWindowWidth	=	document.body.clientWidth;
		iWindowHeight	=	document.body.clientHeight;
		iScrollY		= 	document.body.scrollTop;
		iScrollX		= 	document.body.scrollLeft;
	}
	
	// Make the semi-trasparent background visible
	hActionDiv 					= document.getElementById("actionDiv");
	hActionDiv.style.visibility	= 'visible';
	hActionDiv.style.top		= iScrollY + 'px';
	hActionDiv.style.left		= '0px';
	hActionDiv.style.width		= iWindowWidth + 'px';
	hActionDiv.style.height		= iWindowHeight + 'px';
	
	// Where is the video going?
	iVideoTop	=	((iWindowHeight / 2) - 310) + iScrollY;
	iVideoLeft	=	(iWindowWidth / 2) - ((iWidth / 2) + 10);
	
	// Make the foreground visible
	hActionDiv 					= document.getElementById("actionDivFore");
	hActionDiv.innerHTML		= strContent;
	hActionDiv.style.visibility	= 'visible';
	hActionDiv.style.top		= iVideoTop + 'px';
	hActionDiv.style.left		= iVideoLeft + 'px';
	hActionDiv.style.height		= '300px';

}



























