function showText(){
textAreaId = 'textArea';
//setOpacity(textAreaId, 0);

fadeIn(textAreaId,0);

}
// JavaScript Document
/*************************** Handles fade in **************************/
function fadeIn(objId,opacity,target) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= target) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+","+target+")", 80);
		}
	}
	}
// JavaScript Document
/*************************** Handles fade out **************************/
function fadeOut(objId,opacity) {
	
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 80);
		}
	}/*var browser=navigator.appName;
		if (browser=="Microsoft Internet Explorer"){
		document.getElementById("textArea").style.display="none";
	}*/
}
/*************************** Handles gradual opacity fade **************************/
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

/*************************** Handles showImageGallery **************************/
function DisplayText(NewText)
{
	ShowHideTextAreaId = 'ShowHideTextArea';
	ShowHideText = document.getElementById(ShowHideTextAreaId);
	ShowHideText.innerHTML=NewText;
}
function HideText()
{
	ShowHideTextAreaId = 'ShowHideTextArea';
	ShowHideText = document.getElementById(ShowHideTextAreaId);
	ShowHideText.innerHTML="";
}




function hideTextArea()
{
	//changeState("textArea", "display", "none");
	fadeOut("textArea",0);
	fadeOut("textBg",0);
	//changeState("textBg", "display", "none");
	changeState("xButton", "display", "none");
	changeState("oButton", "display", "block");
}

function showTextArea()
{
	//changeState("textArea", "display", "block");
	//changeState("textBg", "display", "block");
	fadeIn("textArea",0,100);
	fadeIn("textBg",0,70);
	changeState("xButton", "display", "block");
	changeState("oButton", "display", "none");
}

/*************************** Handles showImageGallery **************************/
function showImageGallery()
{
	changeState("wrapper", "display", "none");
	changeState("virtualTour", "display", "block");
	
}
/*************************** Handles showImageGallery **************************/
function hideImageGallery()
{
	changeState("virtualTour", "display", "none");
	changeState("wrapper", "display", "block");
		
}

/*************************** Changes div states on fly **************************/
function changeState(divName, styleType, newStyle){
	document.getElementById(divName).style[styleType]=newStyle;
}
function adjustHeights(){
		
	 var the_height=document.getElementById('textArea').offsetHeight;
	if(the_height>309){
		document.getElementById('textBg').style.height=the_height+20+"px";
		difference=the_height-269;
		var wrapper_height=document.getElementById('wrapper').offsetHeight;
		document.getElementById('wrapper').style.height=wrapper_height+difference-20+"px";
		
		var mainNav_height=document.getElementById('mainNav').offsetHeight;
		document.getElementById('mainNav').style.height=mainNav_height+difference+"px";	
		var textWrapper_height=document.getElementById('textWrapper').offsetHeight;
		document.getElementById('textWrapper').style.height=textWrapper_height+difference+"px";	
	}
	
	/*if(the_height>180){
		difference=the_height-180-380;
		 var wrapper_height=document.getElementById('wrapper').offsetHeight;
		document.getElementById('wrapper').style.height=wrapper_height+difference-20+"px";
		var mainNav_height=document.getElementById('mainNav').offsetHeight;
		document.getElementById('mainNav').style.height=mainNav_height+difference+"px";	
		var textWrapper_height=document.getElementById('textWrapper').offsetHeight;
		document.getElementById('textWrapper').style.height=textWrapper_height+difference+"px";	
		
	}
	*/
}
/***************************/
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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
  
  
}
function checkSecurity(){
  Form_Security_Code=document.getElementById('Form_Security_Code').value;
   hiddenSC=document.getElementById('hiddenSC').value;
   if(Form_Security_Code!=hiddenSC){
   window.location.reload(false);
   //window.location = "http://johnlindberg.com/contact.html"
    alert("The Security Code you entered did not match, please try again");
   }
   
  }
function showDefaultFlash(){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="726" height="580">');
        document.write('<param name="movie" value="flash/default.swf" />');
        document.write('<param name="quality" value="high" />');
        document.write('<param name="wmode" value="transparent" />');
        document.write('<embed src="flash/default.swf" width="726" height="580" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed></object>');
}
function showTourFlash(){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="100%">');
       document.write(' <param name="movie" value="flash/vrTour.swf" />');
        document.write('<param name="quality" value="high" />');
        document.write('<param name="wmode" value="transparent" />');
       document.write('<embed src="flash/vrTour.swf" width="100%" height="100%" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed></object>');
	  
}

function showSecurityCode(){
	var chars = "123456789";
	var string_length = 5;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
document.getElementById('hiddenSC').value =randomstring;
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="92"'); document.write('height="23" NAME="movie">');
document.write('<param name="movie" value="flash/securityCode.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="wmode" value="transparent" />');
document.write('<param name="FlashVars" value="mySecurityCode='+randomstring+'" />');
document.write('<embed src="flash/securityCode.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"'); 
document.write('type="application/x-shockwave-flash" width="92" height="23"  wmode="transparent" FlashVars="mySecurityCode='+randomstring+'"></embed>');
document.write('</object>');}