
//////////////// STANDARD USE JAVASCRIPT FUNCTIONS /////////////////
	
	var	divSize_x = 400,divSize_y = 225;
		
	/*********************************************/		
    function getEl(id){
        /*** less wordy and good for firefox ***/
        return document.getElementById(id);
    }   
    /*********************************************/		
    function getById(id){
        /*** less wordy and good for firefox ***/
        return document.getElementById(id);
    }   
    function go(url,targ) {
    	if(!targ) {
	    	window.location = url;
	    }else {
			eval('window.' + targ + '.location = \'' + url + '\'');
	    }
    }
     /*********************************************/		
	function hideOne(id){ieDisplay('table-'+id,0);ieDisplay(id,0);}
	/*********************************************/		
	function hideAll(id){
		var obj;
	
		//strip all numbers
		id=id.replace(/[0-9]/g,'');
	
		// Hide all divs, day by day
		for(x=1;(obj=getEl(id+x));x++){	hideOne(id+x);}
	}
	/*********************************************/		
	function showdiv(id,maxw,maxh){
	/*  id 		= relative div(the 'window'), 
			  with id in format areaname-day
			  day should be the ONLY numbers!!!!!
			DO NOT USE NUMBERS IN THE 'areaname'!
	    inner table id, should be in the form of table-id , id being in the format listed above
	*/
		try{			
			hideAll(id);
			divobj[id]=getEl(id);
		
			// Size, show, and grow!
			divobj[id].style.width = 10;
			divobj[id].style.height= 10;
			ieDisplay(id,1);
			timers[id] = setInterval('growtosize(\''+id+'\',25,12,'+((maxw)?maxw:divSize_x)+','+((maxh)?maxh:divSize_y)+')',1);
		}catch(e){
			window.status=e.description;
		}
	}
    /***********************************************8
	* Gain access to the FLV flash player and tell it when to start/stop streaming for optimized page performance
	*	Called in shell.php _printbody();
	*	id		-	String	- id of swf object / embed
	*	beg 	-  	BOOL 	- requests that page loads first , then page calls flash vid to begin buffer
	*	newFile - 	string 	- request a new file to play without reloading page
	*/
	function playVideo(id,beg,newFile) {
		
		if(!newFile) {
			newFile = '';
		}
		
		if(is.ie && !beg) {
			window.onload = function() {
				self.setTimeout("playVideo('"+id + "',true,'"+newFile+"');",1000);
			}
		}else {
			self.clearTimeout();
			flash = flashAccess(id);
			try {
				if(newFile) {
					flash.playVideo('',newFile); // start user-clicked video
				}else {
					flash.playVideo();
				}
			}catch(e) { // the page may need a second longer to find the completed flash obj, so try again
				self.setTimeout("playVideo('"+id+"',true,'"+newFile+"');",'1000'); // 1 second
			}
		}
	}
	
	/** MOZILLA strikes again, 
	*	When you absolute position Flash in mozilla, the flash menus, buttons, clickables don't move with the rest of the swf
	*	So, onLoad... reposition the absolute position div containing the flash to exactly where it is in the first damn place
	*	
	*/
	function fixMozillaFlash(id,top) {
		getEl(id).style.top = top;
	}
	
    //*********************************************/	
	function activeEmbed(src,id,width,height,divid,zindex,mediaType,returnMe,quality,allfullscreen) {
		if(!quality) {
			quality = 'high';
		}
		if(!height) {
			height = '100%';
		}
		if(!width) {
			width = '100%';
		}
		
		if(!mediaType || mediaType == 'flash') {
			if(divid) {
				embd = '<div id="'+ divid + '"><embed height="' + height + '" width="' + width + '" src="' + src + '" menu="false" quality="'+ quality + '"  name="' + id + '"  wmode="transparent"  align="middle"  type="application/x-shockwave-flash" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer"/></div>';
			}else {
				embd = '<embed height="' + height + '" width="' + width + '" src="' + src + '" menu="false" quality="'+ quality + '"  name="' + id + '"  wmode="transparent"  align="middle"  type="application/x-shockwave-flash" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer"/>';
			}
			
			objd = '<object height="' + height + '" width="' + width + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  id="' +  id + '" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" align="middle">';
				objd +=	'<param name="allowScriptAccess" value="sameDomain" />';
				objd +=	'<param name="movie" value="'+ src + '" />';
				objd +=	'<param name="menu" value="true" />';
				objd +=	'<param name="allowFullScreen" value="true" />';
				objd +=	'<param name="quality" value="'+ quality + '" />';
				objd +=	'<param name="allowFullScreen" value="true" />';
				if(allfullscreen!='yes'){
					objd +=	'<param name="wmode" value="transparent" />';
				}
				objd += embd;
			objd +=	'</object>';
		}else if(mediaType == 'video') {
			objd = '<embed height="' + height + '" width="' + width + '" src="' + src + '" menu="false" quality="'+ quality + '" name="' + id + '" id="' + id + '" wmode="transparent" align="middle" allowScriptAccess="sameDomain"/>';
		}
		
		if (returnMe) {
			injectTo = getEl(returnMe);
			injectTo.innerHTML = objd;
			return false;
			//return objd;
		}else {
			document.write(objd);
		}
	}
	
	function printImage( popupURL){
		return window.open( popupURL, 'pop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0' );
	}

	/*******************************************************
	* return a working call for the flash object
	*/
	function flashAccess(id) {
		var brs = whichBrs();
		if(brs == 'Mozilla' || brs == 'Firefox') {
			flash = window.document.eval(id);	
		}else if(brs == 'IE' || brs == 'Safari') {
			flash = window.eval(id);	 // safari works on this too
		}else {
			try {
				flash = window.document.eval(id);	
			}catch(e) {
				alert('Sorry, we are trying to access the Flash Object, but cant seem to do that on your browser');
				flash = window.eval(id);	
			}
		}
		return flash;
	}
	
	
	/** DETERMIN BROWSER TYPE --- used to access the Flash Object 
	*/
	function whichBrs() {
		var agt=navigator.userAgent.toLowerCase();
		if (agt.indexOf("opera") != -1) return 'Opera';
		if (agt.indexOf("staroffice") != -1) return 'Star Office';
		if (agt.indexOf("webtv") != -1) return 'WebTV';
		if (agt.indexOf("beonex") != -1) return 'Beonex';
		if (agt.indexOf("chimera") != -1) return 'Chimera';
		if (agt.indexOf("netpositive") != -1) return 'NetPositive';
		if (agt.indexOf("phoenix") != -1) return 'Phoenix';
		if (agt.indexOf("firefox") != -1) return 'Firefox';
		if (agt.indexOf("safari") != -1) return 'Safari';
		if (agt.indexOf("skipstone") != -1) return 'SkipStone';
		if (agt.indexOf("msie") != -1) return 'IE';
		if (agt.indexOf("netscape") != -1) return 'Netscape';
		if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
		if (agt.indexOf('\/') != -1) {
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
		return navigator.userAgent.substr(0,agt.indexOf('\/'));}
		else return 'Netscape';} else if (agt.indexOf(' ') != -1)
		return navigator.userAgent.substr(0,agt.indexOf(' '));
		else return navigator.userAgent;
	}
	function CreateBookmarkLink(title) {
		url = 'http://www.philthyrichrecords.com';
		if (window.sidebar) { // Mozilla Firefox Bookmark		
			window.sidebar.addPanel(title,url,"");	
		}else if( window.external ) { // IE Favorite		
			window.external.AddFavorite( url, title); 
		}else if(window.opera && window.print) { // Opera Hotlist

			return true; 
		} 
	} 
	/****************************************************************************
	*	ActiveX AJAX loader
	*
	*	Attach your own state_change function (along with the injection)
	*	- Use altVars to submit init vars to state_change functions
	*/
	function loadXMLDoc(url,target,altFunction,altVars){
		xmlhttp=null
		xmlhttp = getXmlHttpRequest();
		target = getEl(target);
		if (xmlhttp!=null)
		  {
		  
		  xmlhttp.onreadystatechange=function() {
		  	// Inject
		  	state_Change(target,altFunction,altVars);
		  }
		  document.getElementsByTagName("body").item(0).style.cursor="wait";
		  xmlhttp.open("GET",url,true)
		  xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		  xmlhttp.send(null)
		  }
		else {
		  alert("Your browser does not support XMLHTTP.")
		}
	}
		
	function state_Change(target,altFunction,altVars){
		if (xmlhttp.readyState==4) {
		  if (xmlhttp.status==200) {
		 	
		 	document.getElementsByTagName("body").item(0).style.cursor="auto";
		 	
			target.innerHTML = xmlhttp.responseText;
			
			if(altFunction) {	// Attach functions to process after new data has loaded
				if (typeof altFunction == 'function') var exLoad = altFunction;
		  		if(altVars) {	// Need to send variables to the altFunction
					var runMe = 'exLoad(';
					for(var i in altVars) {
						if(i > 0) {
							runMe += ',';
						}
						if(typeof altVars[i] == 'string') {
							runMe += '\''+ altVars[i] + '\'';
						}else {
							runMe += altVars[i];
						}
					}
					runMe += ')';
					
					eval(runMe);
		  		}else {			// run alternative functions
			  		exLoad();	
			  	}
			  	
		  	}	
		  }else{
		 	 alert("Problem retrieving data:" + xmlhttp.statusText)
		  }
		}
	}
	function getXmlHttpRequest(){
		var httpRequest = null;
		try{
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try{
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e){
				httpRequest = null;
			}
		}
		if (!httpRequest && typeof XMLHttpRequest != "undefined"){
			httpRequest = new XMLHttpRequest();
		}
		return httpRequest;
	}	
	
	
	function len(Ar) {
		var count = 0;
		for(var i in Ar) {
			count++;
		}
		return count;
	}