function btn(obj) {
obj.className = 'btn2';
}


function btn2(obj) {
obj.className = 'btn';
}


function lbtn(obj) {
obj.className = 'lbtn2';
}


function lbtn2(obj) {
obj.className = 'lbtn';
}

function btn3(obj) {
obj.className = 'btn3';
}



var alertpic="";
var newwin="";

function gosite(ste)
{
document.st.os.value=ste;

makeAlert('VIEW INFORMATION WITHIN OUTSIDE SITE' , 'This site will appear in a widow within our site and may take a few minutes to load - please be patient!'); 
}

function brochure(ste)
{
makeAlert("OPEN PRODUCT BROCHURE IN NEW WINDOW" , "The product brochure requested will open in a NEW window. When you are done viewing this information, please close the window to come back to this page!");
newwin=ste;
}



function openwin (ste)
{
makeAlert("OPEN OUTSIDE SITE IN NEW WINDOW" , "This site will now open in a NEW window.<BR>When you are done viewing, please close<BR> the window to come back to our site!");
newwin=ste;
}

function article(ste)
{
alertpic=ste;
makeAlert('VIEW FOUR SEASON COMFORT IFORMATION WINDOW' , ''); 
document.st.os.value="";
}




function hideAlert(){
alertBox.visibility = "hidden";
grayOut(false, {'':'', '':'', '':''});

if(newwin != "")
{

   sOptions = 'status=no,menubar=no, location=no, scrollbars=yes,resizable=no,toolbar=no';
   sOptions = sOptions + ',width=' + (screen.availWidth - 40).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=20,top=50';

  mywindow = window.open (newwin,"_new", sOptions);
  mywindow.moveTo(20,122)

newwin="";
}


if(document.st.os.value !="" )
{
document.st.submit();
document.st.os.value="";
}



}

function makeAlert(aTitle,aMessage){

if (document.getElementById) {

alertBox = document.getElementById("alertLayer").style;}
else
{
if (document.layers) 
{alertBox = document.layers["alertLayer"]; }
else
{ 
alertBox =document.all["alertLayer"].style;
}
}

picHT="";
showimg="<td width=25 align=left><img src='../images/alert.gif'>";




if(aMessage =="")
{
showimg='<td align=left><img src="'+alertpic+'" align="middle" vspace="5" hspace="5">';
picHT=1;
//aMessage="&nbsp;";
}

grayOut(true, {'zindex':'50', 'bgcolor':'#000000', 'opacity':'75'});

document.all.alertLayer.innerHTML = "<table border=0 width=100% height=100%>" +
"<tr height=5><td colspan=4 class=alertTitle>" + " " + aTitle + "</td></tr>" +
"<tr height=5><td width=5></td></tr>" +
"<tr><td width=5></td>"+showimg+"</td><td align=center class=alertMessage>" + aMessage + "<BR></td><td width=5></td></tr>" + 
"<tr height=5><td width=5></td></tr>" +
"<tr><td width=5></td><td colspan=2 align=center><input type=button value='OK' onClick='hideAlert();' class=okButton><BR></td><td width=5></td></tr>" +
"<tr height=5><td width=5></td></tr></table>";
thisText = aMessage.length;
if (aTitle.length > aMessage.length){ thisText = aTitle.length; }

aWidth = (thisText * 5) + 80;
aHeight = 100;
if (aWidth < 150){ aWidth = 200; }
if (aWidth > 350){ aWidth = 350; }
if (thisText > 60){ aHeight = 110; }
if (thisText > 120){ aHeight = 130; }
if (thisText > 180){ aHeight = 150; }
if (thisText > 240){ aHeight = 170; }
if (thisText > 300){ aHeight = 190; }
if (thisText > 360){ aHeight = 210; }
if (thisText > 420){ aHeight = 230; }
if (thisText > 490){ aHeight = 250; }
if (thisText > 550){ aHeight = 270; }
if (thisText > 610){ aHeight = 290; }

if(picHT==1)
{
aWidth=580;
aHeight=680;
}

alertBox.width = aWidth;
alertBox.height = aHeight;
alertBox.left = (document.body.clientWidth - aWidth)/2;
alertBox.top = (document.body.clientHeight - aHeight)/2;
alertBox.visibility = "visible";

}



function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.

location.href="#";

  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= '100%';
    dark.style.display='block';                          
  } else {
     dark.style.display='none';
  }
}



var opn= '[ VIEW ]';
var cls= '[ CLOSE ]';
var hsize='500';
var wsize='500';


function pv(url, id) {



  if(document.all || document.getElementById) {
    document.write('<a id="link'+id+'" href="'+url+'" onClick="pview(this);return false">'+opn+'</a>');
  }
}

function pview(link) {
// Testing for IE 4, since IE4 does not recognize document.getElementById
  var ie4 = (document.all && !document.getElementById) ? true : false;
// If it is IE 4, we set document.all. If we are not IE 4 then we use the standard getElementById
  if (ie4 == 1) {
    var iframe = document.all['if'+link.id];
  }
  else {
    var iframe = document.getElementById('if'+link.id);
  }

  if(link.innerHTML == opn) {
    if(iframe) {
      // Reuses the IFrame if open already
      iframe.src = link.href;
      iframe.style.height = hsize;
      iframe.style.visibility = 'visible';
	} else {
      // Build the Frame and Load the URL
      myBR = document.createElement('br');
      myBR.setAttribute('id','br'+link.id);
      link.parentNode.appendChild(myBR);
      myIframe = document.createElement('iframe');
      myIframe.setAttribute('id','if'+link.id);
      myIframe.setAttribute('width',wsize);
      myIframe.setAttribute('height',hsize);
	  myIframe.setAttribute('class','pframe');
      myIframe.setAttribute('src',link.href);
      link.parentNode.appendChild(myIframe);
    }
    link.innerHTML = cls;
  } else if(iframe) {
    if (ie4 == 1) {
      myBR = document.all['br'+link.id];
    } else {
      myBR = document.getElementById('br'+link.id);
    }
    link.innerHTML = opn;
    link.parentNode.removeChild(iframe);
    link.parentNode.removeChild(myBR);
  }
}




