var isIE = (document.getElementById && document.all)?true:false;
var isNS4 = (document.layers)?true:false;
var isNS6 = (document.getElementById && !document.all)?true:false;
function loadURL(url){
	
	document.location=url;
}


function submitform(formIdent){
	
	document.getElementById(formIdent).submit();
}


function myGetElementById (id)
{
    if ( isIE )
    {
	var str = "document.all('" + id + "')";
	var o = eval(str);
	return o;
    }

    return document.getElementById(id);
}

var pageWidth;
var pageHeight;

function findDimensions(){
	var t = setTimeout("findDimensions1()",300);
}

function findDimensions1()
{
    var frameWidth;
    var frameHeight;
    var obj;

    if (self.innerWidth)
    {
	frameWidth = self.innerWidth;
	frameHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
	frameWidth = document.documentElement.clientWidth;
	frameHeight = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
	frameWidth = document.body.clientWidth;
	frameHeight = document.body.clientHeight;

    }
    else
	return;

    // if there's valid info, update the globals so they can be used elsehere
    pageWidth = frameWidth;
    pageHeight = frameHeight;

    if ( (obj = myGetElementById('background')) )
    {
	obj.style.width = frameWidth;
	obj.style.height = frameHeight;
    }

    if ( (obj = myGetElementById('background_image')) )
    {
	var iWidth = obj.width; 
	var iHeight = obj.height;
	var iRatio = iWidth / iHeight;
	var fRatio = frameWidth / frameHeight;	

	// reset to default position on resize/load
	obj.style.top = obj.style.left = 0;

	if ( iRatio < fRatio ) 
	{
	    obj.style.width = frameWidth;
	    obj.style.height = frameWidth / iRatio;
	} 
	else 
	{
	    obj.style.height = frameHeight;
	    obj.style.width = frameHeight * iRatio;
	}
    }
}
function flip_background(backgroundStatus, whichDiv){
			if (backgroundStatus == "mousein"){
				document.getElementById(whichDiv).style.backgroundColor="#EBEBEB";
				document.getElementById(whichDiv).style.zIndex=1;
			}else{
				document.getElementById(whichDiv).style.backgroundColor="white";
				document.getElementById(whichDiv).style.zIndex=0;
			}
		}
	/*function flip_galleryBorder(backgroundStatus, whichDiv){
			if (backgroundStatus == "mousein"){
				document.getElementById(whichDiv).style.border=dotted;
				document.getElementById(whichDiv).style.backgroundColor="#ffa600";
				document.getElementById(whichDiv).style.zIndex=1;
			}else{
				document.getElementById(whichDiv).style.backgroundColor="white";
				document.getElementById(whichDiv).style.zIndex=0;
			}
		}*/
	function updateImg(updatedImage){
	document.getElementById('media_image').innerHTML = '<img src="' + updatedImage + '" alt="">'

}
function sortNumber(a, b)
{
return a - b
}
function setHeights(){
var t = setTimeout("setHeights1()",300);

}
function setHeights1(){

		if (isIE){
			document.getElementById('contains_all').style.height = (document.body.clientHeight - 50) + "px";
		}else{
			document.getElementById('contains_all').style.height = (window.innerHeight - 50) + "px";
		}
		left_col_height = document.getElementById('outer_col1').offsetHeight 
		middle_col_height = document.getElementById('outer_col2').offsetHeight
		right_col_height = document.getElementById('outer_col3').offsetHeight
		maxValue = document.getElementById('contains_all').offsetHeight

	var highest= new Array(3) 
		highest[0]=maxValue; 
		highest[1]=middle_col_height; 
		highest[2]=right_col_height;   
		sorted = highest.sort(sortNumber);
	



		document.getElementById('outer_col1').style.height = highest[2] + "px";
		document.getElementById('leftColUnderlay').style.height = highest[2] + "px";
		totalPageHeight = left_col_height
		currentCol1Height = document.getElementById('outer_col1').offsetHeight
		
		col1Grayheight = (currentCol1Height - totalPageHeight)
		document.getElementById('gray_spacer_col1').style.height = (col1Grayheight + 10) + "px";
			
		document.getElementById('dotted_vertical_3').style.height = (right_col_height - 2) + "px"
		document.getElementById('dotted_vertical_1').style.height = document.getElementById('outer_col1').style.height
		
	if (middle_col_height > right_col_height){
		document.getElementById('dotted_vertical_2').style.height = (middle_col_height - 2) + "px"
		document.getElementById('col3whitebar').style.height = middle_col_height + "px"
	}else{
		document.getElementById('dotted_vertical_2').style.height = (right_col_height - 2) + "px"
		document.getElementById('col3whitebar').style.height = right_col_height + "px"
		}
}



function resize(id){
	w = document.getElementById(id).width + 20
	h = document.getElementById(id).height + 50

	resizeOuterTo(w,h) 
}

function video_resize(w,h){
	w += 20
	h +=50

	resizeOuterTo(w,h) 
}
function resizeOuterTo(w,h) {
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
 }
}
function jump_nav(newLocation){
		if (newLocation == "0"){
			return false;}else{
			document.location.href=newLocation
		}
	}
	
//AJAX STUFF BELOW HERE- KEEP YOURS HANDS OFF, MURPHY.

// Stuff for the AJAX functions
function createRequestObject(){
				var request_o; //declare the variable to hold the object.
				var browser = navigator.appName; //find the browser name
				if(browser == "Microsoft Internet Explorer"){
					/* Create the object using MSIE's method */
					request_o = new ActiveXObject("Microsoft.XMLHTTP");
				}else{
					/* Create the object using other browser's method */
					request_o = new XMLHttpRequest();
				}
				return request_o; //return the object
}
		
/* The variable http will hold our new XMLHttpRequest object. */
var http = createRequestObject(); 





	function ajaxCreatePopUp(artistID,mediaID,vidType){
		
	http.open('get', 'script/ajaxFunctions.php?function=createPlayerPopup&artist_id='+artistID+'&media_id='+mediaID+'&vidType='+vidType);
				/* Define a function to call once a response has been received. This will be our
					handleProductCategories function that we define below. */
				http.onreadystatechange = function handleResponse(){
					if(http.readyState == 4){ //Finished loading the response
						
						eval(http.responseText);
						
					}
				} ; 
				/* Send the data. We use something other than null when we are sending using the POST
					method. */
				http.send(null);
	
	
	
	//popUpWindow("../players/audio_popup.php?artist_id="+artistID+"&media_id="+mediaID,100,100,360,390)
}
function loadContentIntoDiv(divID,contentURL, artist_id, event_id, event_date){
	
	http.open('get', 'script/ajaxFunctions.php?function=loadEventsPage&artist_id='+artist_id+'&event_id='+event_id+'&event_date='+event_date+'&');
				http.onreadystatechange = function handleResponse(){
					
					if(http.readyState == 4){ //Finished loading the response
						//alert(http.responseText);
						
						document.getElementById(divID).innerHTML = http.responseText
						
					}
				} ; 
				http.send(null);
	
}
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height, vidType)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top);
}

function MM_preloadImages() { //v3.0
  			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 imgOn(imgName) {
			if (document.images) {
			document[imgName].src = "images/" + imgName + "on.gif";
			}
		}

		function imgOff(imgName) {
			if (document.images) {
			document[imgName].src = "images/" + imgName + "off.gif";
			}
		}
		
	function imgOnjpg(imgName) {
			if (document.images) {
			document[imgName].src = "images/" + imgName + "on.jpg";
			}
		}

		function imgOffjpg(imgName) {
			if (document.images) {
			document[imgName].src = "images/" + imgName + "off.jpg";
			}
		}
		
function swapImage(imgName,filename){
	if (document.images) {
		document[imgName].src = filename;
	}
}

function plainPopup(URLStr, left, top, width, height){
  var w = window.open(URLStr, "win", "toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+left+", top="+top);
}


