<!-- 

// LostOnEarth.net Javascript functions

function controlCheck(source, target, val){
	
	if(source.type == 'checkbox'){
	
		if(source.checked == true && target.value != val){

			target.value = val;	
		}
	}
	else{
		if(source.value != val && target.checked == true){
	
			target.checked = false;
		}
	}
}

function showhideElement(source, target){

	if(source.type == 'checkbox'){
	
		if(source.checked == true){

			target.style.visibility = 'hidden';	
		}
		else{
		
			target.style.visibility = 'visible';	
		}

	}
		

}

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 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=findObj(n,d.layers[i].document);
	}
	
	if(!x && d.getElementById){
		
		x=d.getElementById(n); 
	}
	
	return x;
}

function stripSpaces(s){
	
	while((s.indexOf(' ',0) == 0) && (s.length > 1)){
		
		s = s.substring(1,s.length);
	}
	
	while((s.lastIndexOf(' ') == (s.length - 1) && (s.length > 1))){
		
		s = s.substring(0,(s.length - 1));
	}
	
	if((s.indexOf(' ',0) == 0) && (s.length == 1)){
	
		s = '';
	}
	
	return s;
}

function explodeArray(item,delimiter) {
  tempArray=new Array(1);
  var Count=0;
  var tempString=new String(item);

  while (tempString.indexOf(delimiter)>0) {
    tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
    tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
    Count=Count+1
  }

  tempArray[Count]=tempString;
  return tempArray;
}

function checkForm(){

	var i, e, t, m, errors = '', args = checkForm.arguments;
	
	for (i=0; i<(args.length-2); i+=3) { 
		
		m = args[i+2];
		t = args[i+1];
		e = MM_findObj(args[i]);
		
		if (t.charAt(0) == 'A'){
			
			t = MM_findObj(t.slice(1,t.length));
			
			if( (t.value != "") && (e.value > test.value) ){
				
				errors += '- ' + m + '\n'; 
			}
		}
		else if (t.charAt(0) == 'B'){
			
			t = MM_findObj(t.slice(1,t.length));
			
		}		
		else if (t.charAt(0) == 'M'){ // Check if value is valid emailaddress
			
			var s_email = e.value;
			s_email = s_email.replace(/^\s*|\s*$/g,"");
				
			ml = explodeArray(s_email,';');
			
			for(n=0;n<ml.length;n++){
				
				if((ml[n].length < 6) ||
				   (ml[n].indexOf('@',0) < 1) ||
				   (ml[n].lastIndexOf('@') != ml[n].indexOf('@',0)) ||
				   (ml[n].lastIndexOf('@') > (ml[n].length - 5)) ||
				   (ml[n].lastIndexOf('.') > (ml[n].length - 3)) ||
				   (ml[n].lastIndexOf('.') < (ml[n].length - 4)) ||
				   (ml[n].indexOf('..',0) > -1) ||
				   (ml[n].indexOf('@.',0) > -1) ||
				   (ml[n].indexOf('.@',0) > -1) ||
				   (ml[n].indexOf(',',0) > -1)){

					if(n==(ml.length-1) && ml[n] == ''){
					
					}
					else{
					
						var err = true;
					}
				}
				
			}
			
			if(err) errors += '- ' + m + '\n';
		}
		else if (t.charAt(0) == 'd'){
			
			if((e.value > 31) || e.value == "" || e.value == 'DD'){
				
				errors += '- ' + m + '\n'; 
			}
			
		}		
		else if (t.charAt(0) == 'D'){
			
			var d=new Date();
			
			var iy = e.value.substring(0,4);
			var im = e.value.substring(5,7);
			var id = e.value.substring(8,10);
			
			if((e.value == "") || (e.value.length < 10) || (id > 31) || (im > 12)){
							
				errors += '- ' + m + '\n'; 
			}
			
		}		
		else if (t.charAt(0) == 'm'){
			
			if((e.value > 13) || e.value == "" || e.value == 'MM'){
				
				errors += '- ' + m + '\n'; 
			}
			
		}		
		else if (t.charAt(0) == 'p'){
			
			if( (e.value.length < 4) ){
				
				errors += '- ' + m + '\n'; 
			}
		}
		else if (t.charAt(0) == 'P'){
			
			t = MM_findObj(t.slice(1,t.length));
			
			if((t.value.length < 6) || (e.value.length < 6) || (e.value != t.value) ){
				
				errors += '- ' + m + '\n'; 
			}
		}
		else if (t.charAt(0) == 'y'){
			
			var d=new Date();
			if((e.value > d.getFullYear()) || e.value == "" || e.value == 'YEAR'){
				
				errors += '- ' + m + '\n'; 
			}
			
		}		
		else if (t.charAt(0) == 'U'){
			
			if(e.value.length < 6 || e.value == ''){
				
				errors += '- ' + m + '\n'; 
			}
			
		}		
		else if (t.charAt(0) == 'S'){
			
			test = t.slice(1,t.length);
			
			if( (e.value == "") || (e.value == test) || (e.value.length < 2) ){
				
				errors += '- ' + m + '\n'; 
			}
		}
		else if (t.charAt(0) == 'T'){
			
			if(e.checked != 1){
				
				errors += '- ' + m + '\n'; 
			}
			
		}		
		else{
			if(e.value == "" || e.value == " "){
				
				errors += '- ' + m + '\n'; 
			}
		}
	}
	if(errors) {
		
		alert('The following error(s) occurred:\n' + errors);
	}
	
	document.returnValue = (errors == '');	
}

function popIt(url,w,h,id){
	
	if(!id){
		
		var id = "unknown";
	}
	
	var wd = "Console " + id;
	window.status='Click to open ' + wd + '!';
	
	if (!wd.closed && wd.location){
		
		wd.focus();
	}
	else{
		
		wd = window.open( url, id, 'left=' + ( (screen.width/2) - (w/2) ) + ', top=' + ( (screen.height/2) - (h/2) -20 ) + ',width=' + w + ', height=' + h + ', resizable=1, scrollbars=1,toolbar=0,status=1,location=0,directories=0,menubar=0');
		
		if (!wd.opener){
		
			wd.opener = self;
		}
	}
	
	if (window.focus) {
	
		wd.focus();
	}
}

function swap(td_name, image) {

	document.getElementById(td_name).style.background=image;
}

var ie4 = false; if(document.all) { ie4 = true; }

function toggle(link, divId) {
	var d = MM_findObj(divId);
	var lText = link.innerHTML; 
	if (d.style.display == 'none') {
 		link.innerHTML = 'Click here to hide my personal information'; //'<img src=\'img/implode001.gif\'>'; 
 		d.style.display = 'block';
 	}
 	else {
 		link.innerHTML = 'Click here to see my personal information'; //'<img src=\'img/explode001.gif\'>'; 
 		d.style.display = 'none';
 	}
}

function toggleRead(link, divId) {
	var d = MM_findObj(divId);
	var lText = link.innerHTML; 
	if (d.style.display == 'none') {
 		//link.innerHTML = 'Click here to hide my personal information'; //'<img src=\'img/implode001.gif\'>'; 
 		d.style.display = 'block';
 	}
 	else {
 		//link.innerHTML = 'Click here to see my personal information'; //'<img src=\'img/explode001.gif\'>'; 
 		d.style.display = 'none';
 	}
}
	
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

function hidelayer(lay) {

	if (ie4) {document.all[lay].style.visibility = "hidden";}
	if (ns4) {document.layers[lay].visibility = "hide";}
	if (ns6) {document.getElementById([lay]).style.display = "none";}
}
function showlayer(lay) {

	if (ie4) {document.all[lay].style.visibility = "visible";}
	if (ns4) {document.layers[lay].visibility = "show";}
	if (ns6) {document.getElementById([lay]).style.display = "block";}
}
function confirmDelete(){

	var agree=confirm("Are you sure you want to delete this record?");
	if (agree)
		return true ;
	else
		return false ;
}
function confirmRemove(){

	var agree=confirm("Are you sure you want to disconnent selected photos?");
	if (agree)
		return true ;
	else
		return false ;
}

// AJAX FUNCTIONS
	
function handleHttpResponse() {
 if (http.readyState == 4) {
  var result = http.responseText;
  if(result){
   results = http.responseText.split("<!--SPLIT-->");
   for(i=0;i<(results.length-1); i+=2){
    if(results[i]=='page'){
     var e = document.getElementById('contentFrame');
     e.innerHTML = results[i+1];
    }
    else if(results[i]=='JS'){
     eval( results[i+1] );
    }
    else{
     alert(results[i+1]);
    }
   }
  }
 }
}

function getHTTPObject() {
 var xmlhttp;
 /*@cc_on
 @if (@_jscript_version >= 5)
   try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch (e) {
    try {
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (E) {
     xmlhttp = false;
    }
   }
 @else
   xmlhttp = false;
 @end @*/

 if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
  try {
   xmlhttp = new XMLHttpRequest();
  }
  catch (e) {
   xmlhttp = false;
  }
 }
 
 return xmlhttp;
}

var http = getHTTPObject(); // We create the HTTP Object

function loadPage(i,v) {
 var url = "content_" + i + ".php" + v;
 http.open("GET", url, true);
 http.onreadystatechange = handleHttpResponse;
 http.send(null);
 scroll(0,0);
}

function loadHeader(i) {
 var file = "slideshow.swf?t="+i;
 var url = "slideshow.php?t="+i+"&o=bool";
 var w = 525;
 var h = 229;
 var data = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + w + "' height='" + h + "'><param name='movie' value='" + file + "'><param name='quality' value='high'><embed src='" + file + "' quality='high' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='" + w + "' height='" + h + "'></embed></object>";
 http.open("GET", url, true); 
 http.onreadystatechange = function(){
  if(http.readyState == 4){
   if(http.responseText && document.getElementById('contentHeaderType').value != i){
    document.getElementById('contentHeader').innerHTML = data;
    document.getElementById('contentHeaderType').value = i;
   }
  }
 }
 http.send(null);
}

function mailinglist(i, a) {
 var url = "post.php?action="+a+"&ml_email="+i;
 http.open("GET", url, true);
 http.onreadystatechange = handleGetResponse;
 http.send(null);
}

function handleGetResponse() {
 if (http.readyState == 4) {
  var result = http.responseText;
  if(result){
   results = http.responseText.split("<!--SPLIT-->");
   for(i=0;i<(results.length-1); i+=2){
    if(results[i]=='TEXT'){
     var e = document.getElementById('msgDiv');
     e.innerHTML = results[i+1];
    }
    else if(results[i]=='JS'){
     eval( results[i+1] );
    }
    else{
     alert(results[i+1]);
    }
   }
  }
 }
}

-->