//**********************************************************************
// Generic Functions
//**********************************************************************   
function killKey()
{
	event.keyCode = 0;
	event.returnValue = false;
	event.cancelBubble = true;
}

//**********************************************************************
// Popup Window Functions
//**********************************************************************   
function NewWindow(mypage,myname,w,h,scroll,pos)
{
   if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
   if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
   else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
   settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
   win=window.open(mypage,myname,settings);
}

function popWindow(location,height,width,resizable)
{
   if (height == null || height == "undefined") height="400";
   if (width == null || width == "undefined") width="400";
   if (resizable == null || resizable == "undefined") resizable="no";
             
   window.open(location,"_blank","height=" + height + ",width=" + width + 
               ",resizable=" + resizable + ",status=no,toolbar=no,menubar=no,location=no");
}

function popWindow2(location,height,width,resizable,scroll)
{
   if (height == null || height == "undefined") height="400";
   if (width == null || width == "undefined") width="400";
   if (resizable == null || resizable == "undefined") resizable="no";
             
   window.open(location,"_blank","height=" + height + ",width=" + width + 
               ",resizable=" + resizable + ",scrollbars=" + scroll + 
               ",status=no,toolbar=no,menubar=no,location=no");
}

//**********************************************************************
// Image Rollover Functions
//**********************************************************************   
function MM_swapImgRestore() 
{	//v3.0
	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_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 MM_findObj(n, d) 
{	//v4.01
	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() 
{	//v3.0
	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];
	}
}

//**********************************************************************
// Cookie Functions
//**********************************************************************   
// store info on cookie. 
function setCookie(name, value, days) 
{
   var expire = new Date ();
   expire.setTime (expire.getTime() + (24 * 60 * 60 * 1000) * days); 
   document.cookie = name + "=" + escape(value) + "; expires=" + expire.toGMTString(); 
}

// retrieve info on cookie. 
function getCookie(name) 
{
   var startIndex = document.cookie.indexOf(name); 
   if (startIndex != -1) 
   {
      var endIndex = document.cookie.indexOf(";", startIndex); 
      if (endIndex == -1) endIndex = document.cookie.length;
      return unescape(document.cookie.substring(startIndex+name.length+1, endIndex)); 
   } 
   else 
   {
      return null; 
   }
}

// delete info on cookie. 
function deleteCookie(name) 
{
   var expire = new Date ();
   expire.setTime (expire.getTime() - (24 * 60 * 60 * 1000)); 
   document.cookie = name + "=; expires=" + expire.toGMTString(); 
}

//**********************************************************************
// Song Play Tracking Function
//**********************************************************************   
function incrementSongPlays()
{
	var iPlays = getCookie("SongPlayCount");
	if (iPlays == null) iPlays = 0;
	setCookie("SongPlayCount", parseInt(iPlays) + 1, 10000);
}

//**********************************************************************
// General Functions
//**********************************************************************   
function toggleDiv(div)
{
	div.style.display = (div.style.display == 'none') ? 'block' : 'none';
}

//**********************************************************************
// Upload Progress Functions
//********************************************************************** 
<!--
function trackUpload(id) 
{
	if ((typeof(Page_BlockSubmit) == 'boolean') && (Page_BlockSubmit == true)) return;

	// show the upload progress frame
	var frame = document.getElementById('fraProgress')
	frame.src = 'uploadprogress.aspx?progressid=' + id;
	frame.style.display = 'block';	

	// get the form
	var frm = document.forms[0];
	
	// remove the upload querystring if there already is one
	var pos = frm.action.toLowerCase().indexOf('uploadid=')
	if (pos > -1) frm.action = frm.action.substring(0, pos - 1);
	
	// append the new upload id to the end
	frm.action += (frm.action.indexOf('?') > -1 ? '&' : '?');
	frm.action += 'uploadid=' + id;
	frm.submit();
	return false;
}
//-->

//**********************************************************************
// Netscape CSS Bug Fix Functions
//**********************************************************************   
function WM_netscapeCssFix() {
	if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
		location.href = location.href;
	}
}

function WM_netscapeCssFixCheckIn() {
	if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
		if (typeof document.WM == 'undefined') {
			document.WM = new Object;
		}
		if (typeof document.WM.WM_scaleFont == 'undefined') {
			document.WM.WM_netscapeCssFix = new Object;
			document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
			document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
		}
		window.onresize = WM_netscapeCssFix;
	}
}

WM_netscapeCssFixCheckIn();

//********************************
// Pop Under Functions
//********************************
function newScreen() {
	var page = "http://www.livemansion.com";
	var windowprops = "width=850,height=600,location=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes";
	var count = getCookie('AScount');
	//document.write("count before:" + count);
	if (count == null) {
		count = 1;
		setCookie('AScount', "1", 1);
	}
	else if (count == 1) {
		count = 2;
		newWindow = window.open(page, "PopupName", windowprops);
		newWindow.blur();
		setCookie('AScount', count, 1);		
	}
	//document.write("<Br>count after:" + count);
	
}


function ConfirmDelete(TheURL)
{
	var name = confirm("Are you sure you want to delete?")
	if (name == true)
	{	 
		window.location.href = TheURL
		window.navigate
		//alert("User has been deleted from the system.\nRefresh your browser for latest version.")
	}
	else
	{ 
		this.open
	}
}