// JavaScript Document
/************************************************************************************************************
Ajax dynamic list
Copyright (C) September 2005  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com
	
************************************************************************************************************/	
function showToolTip(e,text){	
	if(document.all)e = event;
	
	var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	obj2.innerHTML = text;
	obj.style.display = 'block';
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
	var leftPos = e.clientX - 100;
	if(leftPos<0)leftPos = 0;
	obj.style.left = leftPos + 'px';
	obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
}	

function hideToolTip()
{	
	document.getElementById('bubble_tooltip').style.display = 'none';	
}

	
/************************************************************************************************************/	

//get Material estimate length
function getLength(signbrand, sideType){
/*
  document.frlength.act.value="result";
  document.frlength.action="fr1250_price.asp";
  document.frlength.submit();
 
  */
 
	 var h = document.getElementById("fheight").value;
	 var w = document.getElementById("fwidth").value;
	 var result1 = 0.0, result2 = 0.0;
	 var waste = 16;
	 
	 //document.getElementById("s_len").innerText = "";
//alert(sideType);
	 if (h.length <= 0) 
		h = -1;
	 else
		h = h*1;
	
	 
	 if (w.length <= 0) 
		w = -1;
	 else
		w = w*1;
	
	
	 
	 if (h == -1 || w == -1) {
		 if (h == -1 && w != -1) {
	   		document.getElementById("s_len").innerHTML = "<b><font style='color:red'>* Please enter Height to calculate the lengths needed</font></b>";
			document.getElementById("fheight").focus();
		 }
		 else if (w == -1 && h != -1) {
	   		document.getElementById("s_len").innerHTML = "<b><font style='color:red'>* Please enter Width to calculate the lengths needed</font></b>";
			document.getElementById("fwidth").focus();
		 }
		 else if (h == -1 && w == -1) {
	   		document.getElementById("s_len").innerHTML = "<b><font style='color:red'>* Please enter Height and Width to calculate the lengths needed</font></b>";
			document.getElementById("fheight").focus();
		 }
		 
	 }
	 else 
     {

       if (sideType == "single") 
	   { 
        if(signbrand =="signpro" || signbrand =="php"){       result1 = (h*2 + w*2 + waste)/12/22.25;}
        else if(signbrand =="flipframe"){       result1 = (h*2 + w*2 + waste)/12/12;}
        document.getElementById("s_len").innerHTML = "Single Sided Cabinet: <b>" + Math.round(result1*100)/100 + "</b> length(s)<br />Face frame: <b>" + Math.round(result1*100)/100 + "</b> length(s)";
	   }
       else if (sideType == "double") 
       {
         if(signbrand =="signpro" || signbrand =="php"){result1 = (h*2 + w*2 + waste)/12/22.25;}
         else if(signbrand =="flipframe"){ result1 = (h*2 + w*2 + waste)/12/12;}
	     result2 =Math.round(result1*100)/100 *2 ;
        document.getElementById("s_len").innerHTML = "Double Sided Cabinet: <b>" + Math.round(result1*100)/100 + "</b> length(s)<br />Face frames: <b>" + Math.round(result2*100)/100 +"</b> length(s)";
	  
       }
	  
	  }
}

//function for price iframe height
function SetCwinHeight(win){ 
  var cwin=win;
  /*document.getElementById(win); */
  if (document.getElementById){
      if (cwin && !window.opera) {
          if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
              cwin.height = cwin.contentDocument.body.offsetHeight + 20 + "px";
          else if(cwin.Document && cwin.Document.body.scrollHeight)
              cwin.height = cwin.Document.body.scrollHeight + 20 + "px";
      }
  }
 
}












