﻿// JScript File

function VisibleControlsPostHome(trName, trName1, spnName, trText, spnPackage, rblName, Position) 
{
    var rblControl = document.getElementById(rblName);

    if (rblControl)
    {
        if (rblControl.cells[Position].children[0].checked)
        {
            document.getElementById(trName).style.display = "none";
            document.getElementById(trName1).style.display = "block";
            document.getElementById(spnName).style.display = "none";
            document.getElementById(trText).style.display = "none";
            document.getElementById(spnPackage).style.display = "none";
        }
        else
        {
            document.getElementById(trName).style.display = "block";
            document.getElementById(trName1).style.display = "none";
            document.getElementById(spnName).style.display = "block";
            document.getElementById(trText).style.display = "block";
            document.getElementById(spnPackage).style.display = "block";
        }
    }
}
 function ShowPrice()
     {
         if(document.getElementById("rblFinance_0").checked)
         {
            document.getElementById("trPrice").style["display"]="none";
            document.getElementById("Txt_askprice").value="";            
         }
         else 
         {
            document.getElementById("trPrice").style["display"]="block";
         }
     }
function VisibleControls(spnName,rblName,Position)
{
    var rblControl=document.getElementById(rblName);
     var chkid=document.getElementById(rblName).id;
 
    if(chkid=="rblVisible" || chkid=="rblGradingFunction" || chkid=="rblSafetyIssues" || chkid=="rblFunctionDuctwork" || chkid=="rblExteriorDecay"
    || chkid=="rblSealants" || chkid=="rblRainWaterControl" || chkid=="rblSepticIssue")
    {
          
            if(rblControl.cells[0].children[0].checked || rblControl.cells[1].children[0].checked)
            {
                document.getElementById(spnName).style.display="block";
            }
            else
            {
                document.getElementById(spnName).style.display="none";
            }
        
     }
    else
    {   
        if(rblControl)
        {
            if(rblControl.cells[Position].children[0].checked)
            {
                document.getElementById(spnName).style.display="block";
            }
            else
            {
                document.getElementById(spnName).style.display="none";
            }
        }
   }
}

function VisibleSignsControls(spnName,rblName, trName, Position)
{
    var rblControl=document.getElementById(rblName);
     document.getElementById(spnName).style.display="block";
    if(rblControl)
    {
        if(rblControl.cells[Position].children[0].checked)
        {
           
             document.getElementById(trName).style.display="block";
        }
        else
        {
          
             document.getElementById(trName).style.display="none";
        }
    }
}


function VisibleControlsddl(spnName,rblName,Position)
{
    var rblControl=document.getElementById(rblName);
     var chkid=document.getElementById(rblName).id;
     
       if(chkid=="ddlWaterSupply")
       {
        
            if(rblControl.options[rblControl.selectedIndex].text == "No" || rblControl.options[rblControl.selectedIndex].text == "Yes")
            {
                document.getElementById(spnName).style.display="block";
            }
            else
            {
                document.getElementById(spnName).style.display="none";
            }
        
       }
       else
       {
        if(rblControl)
        {
            if(rblControl.options[rblControl.selectedIndex].text == Position)
            {
                document.getElementById(spnName).style.display="block";
            }
            else
            {
                document.getElementById(spnName).style.display="none";
            }
        }
    }
}

function opencal(cname)
{
window.open('../common/frmCalendar.aspx?cname='+cname,'','menubar=0,height=240,width=230');
return false;
}

function ShowGetQuotes()
{
window.open('../UclLinks/GetQuotes.aspx','','width=700,height=780,menubar=no,toolbar=no,scrollbars=yes');
}

  function validateEmail(str)
{
    if(str != "")
    {
	 
        var strexp=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
        if (strexp.test(str))
        {
            return 1;
        }
        else
			
        {
		
            return 0;
        }
    }
}

//function validateEmail(mailids)
//{
//var arr = new Array('.com','.net','.org','.biz','.coop','.info','.museum','.name','.pro'
//,'.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag','.ai','.al',
//'.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw','.az','.ba','.bb',
//'.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm','.bn','.bo','.br','.bs',
//'.bt','.bv','.bw','.by','.bz','.ca','.cc','.cd','.cf','.cg','.ch','.ci',
//'.ck','.cl','.cm','.cn','.co','.cr','.cu','.cv','.cx','.cy','.cz','.de',
//'.dj','.dk','.dm','.do','.dz','.ec','.ee','.eg','.eh','.er','.es','.et',
//'.fi','.fj','.fk','.fm','.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh',
//'.gi','.gl','.gm','.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy',
//'.hk','.hm','.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io',
//'.iq','.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
//'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li','.lk',
//'.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg','.mh','.mk',
//'.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt','.mu','.mv','.mw',
//'.mx','.my','.mz','.na','.nc','.ne','.nf','.ng','.ni','.nl','.no','.np',
//'.nr','.nu','.nz','.om','.pa','.pe','.pf','.pg','.ph','.pk','.pl','.pm',
//'.pn','.pr','.ps','.pt','.pw','.py','.qa','.re','.ro','.rw','.ru','.sa',
//'.sb','.sc','.sd','.se','.sg','.sh','.si','.sj','.sk','.sl','.sm','.sn',
//'.so','.sr','.st','.sv','.sy','.sz','.tc','.td','.tf','.tg','.th','.tj',
//'.tk','.tm','.tn','.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug',
//'.uk','.um','.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu',
//'.ws','.wf','.ye','.yt','.yu','.za','.zm','.zw');

//var mai = mailids;
//var val = true;
//var beforeat="";
//var afterat="";
//var afterat2="";

//var dot=mai.lastIndexOf(".");
//var con=mai.substring(dot, mai.length);
//con=con.toLowerCase();
//con=con.toString();

//for(var i=0;i<(arr.length);i++)
//{
//	if(con == arr[i])
//	{
//		val=true;
//		break;
//	}
//	else
//	{
//		val=false;
//	}
//}

//var att=mai.lastIndexOf("@");
//beforeat=mai.substring(0,att);
//beforeat=beforeat.toLowerCase();
//beforeat=beforeat.toString();
//var asci1=beforeat.charCodeAt(0);

//afterat=mai.substring(att+1, dot);
//afterat=afterat.toLowerCase();
//afterat=afterat.toString();

//afterat2=mai.substring(att+1, mai.length);
//afterat2=afterat2.toLowerCase();
//afterat2=afterat2.toString();

//if(beforeat=="" || afterat=="" || beforeat.length>30)
//	val=false;

//if(afterat2.length>64 || afterat.length<2)
//	val=false;

//if((afterat.charCodeAt(0))==45 || (afterat.charCodeAt(afterat.length-1))==45)
//	val=false;

//if(val==true)
//{
//	if(asci1 > 47 && asci1 < 58)
//		val=false;
//		
//	if(asci1 < 48 || asci1 > 57)
//	{
//		for(var i=0; i<=beforeat.length-1; i++)
//		{
//			var asci2=beforeat.charCodeAt(i);
//			if((asci2<=44 || asci2==47) || (asci2>=58 && asci2<=94) || (asci2==96) || (asci2>=123 && asci2<=127))
//			{
//				val=false;
//				break;
//			}
//		}
//		
//		for(var j=0; j<=afterat.length-1; j++)
//		{
//			var asci3=afterat.charCodeAt(j);
//			if((asci3<=44) || (asci3==46) || (asci3==47) || (asci3>=58 && asci3<=96) || (asci3>=123 && asci3<=127))
//			{
//				val=false;
//				break;
//			}
//		}	
//	}
//}

//if(val==false)
//{
//	return false;
//}
//else
//{
//	return true;
//}
//}

//function zipcodetoradius(txtzip,ddlradius)
// {
//     if(document.getElementById(txtzip).value.length=="5")
//     {
//       document.form1.ddlradius.value="20";
//     }
//     else
//     {
//      document.form1.ddlradius.value="0";
//     }
// }
 function checkdate(dateString, from)
        {
         var now = new Date();
         
       	if(from == "reg")
		{
	          var dt=new Date(dateString);
    	      
              var d=dt.getFullYear();
              var n=now.getYear()-20;
            
              if(d > n) // 2007>1987 invalid
              {
		           return 0;
		      }
	          else
		      {
		           return 1;
		      }                     

        }
        else
        {
      
            if(Date.parse(dateString) > Date.parse(now))
		    {
		          //alert(dateString);
	  	          return 0;
		    }
	        else
		    {
		          return 1;
		    }
            }
        }

function DisplayPHInsState(ddlinscountry,txtinszip,txtinspostal,spninszip,spninspostal,ddlradius,radius)
{

     var countryid= document.form1.ddlinscountry.value;
       if(countryid=="1")
     {
      document.getElementById(txtinszip).style.display="block";
      document.getElementById(txtinspostal).style.display="none";
       document.getElementById(spninszip).style.display="block";
          document.getElementById(spninspostal).style.display="none";
      
      document.getElementById(txtinszip).value="";
      document.getElementById(txtinspostal).value="";
      if(radius=="yes")
      {
      document.getElementById(ddlradius).value="0";
      }
       
     }
     else if(countryid=="2")
     {
      document.getElementById(txtinszip).value="";
      document.getElementById(txtinspostal).value="";
     document.getElementById(txtinszip).style.display="none";
      document.getElementById(txtinspostal).style.display="block";
         document.getElementById(spninszip).style.display="none";
          document.getElementById(spninspostal).style.display="block";
     if(radius=="yes")
      {
      document.getElementById(ddlradius).value="0";
      }
     }
     
}

function AdminDisplayState(spnstate,spnprovince,ddlstate,ddlprovince,ddlcounty,spnzip,spnpostal,txtzip,txtpostal)
{
var countryid=document.form1.ddlcountry.value;
if(countryid=="1")
{
     document.getElementById(spnstate).style.display="block";
     document.getElementById(spnprovince).style.display="none";
     document.getElementById(ddlstate).style.display="block";
     document.getElementById(ddlprovince).style.display="none";
      document.getElementById(ddlprovince).value="0";
      if(document.getElementById(spnzip))
      {
       document.getElementById(spnpostal).style.display="none";
       document.getElementById(txtpostal).style.display="none";
              document.getElementById(spnzip).style.display="block";
       document.getElementById(txtzip).style.display="block";
       }
}
else if(countryid=="2")
{
    document.getElementById(spnstate).style.display="none";
    document.getElementById(spnprovince).style.display="block";
    document.getElementById(ddlstate).style.display="none";
    document.getElementById(ddlprovince).style.display="block";
     document.getElementById(ddlstate).value="0";
      if(document.getElementById(spnzip))
      {
     document.getElementById(spnpostal).style.display="block";
       document.getElementById(txtpostal).style.display="block";
        document.getElementById(spnzip).style.display="none";
       document.getElementById(txtzip).style.display="none";
       }
}
}

 function DisplayState(spnzip,spnpostal,spnstate,spnprovince,ddlstate,ddlprovince,txtzip,txtpostal,pgtype,spncounty,ddlcounty,ddlradius,radius,spn_statefirst)
 {
 if(pgtype=="indexcont")
 {
    var countryid= document.form1.ddlcontcountry.value;
 }
 else  if(pgtype=="indexcpol")
 {

    var countryid= document.form1.ddlcpolcountry.value;
 }
 else
 {
    var countryid= document.form1.ddlcountry.value;
 }
 
 if(countryid=="1")
 {
     if(pgtype=="posthome")
     {
      document.getElementById(spncounty).style.display="block";
      document.getElementById(ddlcounty).style.display="block";      
      document.getElementById(spn_statefirst).style.display="block";
     }
 
     document.getElementById(spnzip).style.display="block";
     document.getElementById(txtzip).style.display="block";
     document.getElementById(spnstate).style.display="block";
     document.getElementById(ddlstate).style.display="block";
     
     document.getElementById(spnpostal).style.display="none";
     document.getElementById(txtpostal).style.display="none";
     document.getElementById(spnprovince).style.display="none";
     document.getElementById(ddlprovince).style.display="none";
     document.getElementById(ddlprovince).value="0";
     document.getElementById(txtpostal).value="";
     document.getElementById(ddlstate).value="0";
  document.getElementById(txtzip).value="";
    
  if(radius=="yes")
  {
  document.getElementById(ddlradius).value="0";
  }
  
 }
 else if(countryid=="2")
 { 
 
  if(pgtype=="posthome")
 {
 
 document.getElementById(spncounty).style.display="none";
 document.getElementById(ddlcounty).style.display="none";
 removeChildren(document.getElementById(ddlcounty));
 AddItem(document.getElementById(ddlcounty));
  
 
 
 document.getElementById(spn_statefirst).style.display="none";
 }
     document.getElementById(ddlstate).value="0";
     document.getElementById(txtzip).value="";
     document.getElementById(ddlprovince).value="0";
     document.getElementById(txtpostal).value="";
     document.getElementById(spnzip).style.display="none";
     document.getElementById(txtzip).style.display="none";
     document.getElementById(spnstate).style.display="none";
     document.getElementById(ddlstate).style.display="none";
         
     document.getElementById(spnpostal).style.display="block";
     document.getElementById(txtpostal).style.display="block";
     document.getElementById(spnprovince).style.display="block";
     document.getElementById(ddlprovince).style.display="block";
      if(radius=="yes")
  {

  document.getElementById(ddlradius).value="0";
  }
  
 }
}


function removeChildren(s)
{
        while (s.hasChildNodes())
        s.removeChild(s.childNodes[0]);
}
function AddItem(a)
{
        // Create an Option object             
         var opt = document.createElement("option");

        // Add an Option object to Drop Down/List Box
        a.options.add(opt);        // Assign text and value to Option object
        opt.text = "--Select--";
        opt.value = "0";
}

function trimAll(sString) 
{
    while (sString.substring(0,1) == ' ')
    {
         sString = sString.substring(1, sString.length);
    }
    while (sString.substring(sString.length-1, sString.length) == ' ')
    {
        sString = sString.substring(0,sString.length-1);
    }
    
    return sString;
}
        

function formatCurrency(num) 
{

    num = trimAll(num.toString().replace(/\$|\,/g,''));
   
    if(isNaN(num)== false)
    {
    
 
    if(isNaN(num))
    {
  
    num = "0";
    
    }
    
    sign = (num == (num = Math.abs(num)));
   // alert(sign)
    num = Math.floor(num*100+0.50000000001);
  //  alert(num);
    cents = num%100;
    num = Math.floor(num/100).toString();
  //  alert(num);
    if(cents<10)
    cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+','+
    num.substring(num.length-(4*i+3));
   // return (((sign)?'':'-') + '$' + num + '.' + cents);
     return (((sign)?'':'-') +  num + '.' + cents);
     }
     
     else
     {
     return num;
     }
}

  function phonefn(prev,next)
    {
     var prevControl=prev;
     if (prevControl.value.length >=3)
     {
      next.focus();
     }
    } 
    
	 
        function checkscheduledate(dateString)
        {
        var now = new Date();
               
	   	var today = new Date(now.getYear(),now.getMonth(),now.getDate());
	    
		var testdate = new Date(dateString.substring(6,10), dateString.substring(0,2)-1, dateString.substring(3,5));

		if(testdate < today)
		{
	
		return 0;
		}
	    else
		{
		    return 1;
		}	
        }

 function ShowCountry(txtzip, ddlcountry, ddlstate)
    {
  
    if(document.getElementById(txtzip).value!="")
    {
        if(trimAll(document.form1.txtzip.value).length=="5")
        {
            document.form1.ddlcountry.value="1";
        }
        else if(document.form1.txtzip.value.length!="5")
        {
            document.form1.ddlcountry.value="0";
        }
    }
    else
    {
        var state=document.getElementById(ddlstate).value;
        if(state!="0")
        {
               document.form1.ddlcountry.value="1";
        }
    }
    }



// function isDate(dateStr)
//	{
//    	var datePat = /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/;
//	    var matchArray = dateStr.match(datePat); // is the format ok?
//    	if(dateStr.length==0)
//	    {
//    	    return true;
//	    }
//      	if(dateStr.length!=10)
//	    {
//    	    return false;
//	    }
//	  	if (matchArray == null)
//	    {
//    	    return false;
//	    }

//    	month = matchArray[1]; // parse date into variables
//	    day = matchArray[3];
//	    year = matchArray[5];

//    	if (month < 1 || month > 12) // check month range
//	    {
//    	    return false;
//	    }

//    	if (day < 1 || day > 31)
//	    {
//    	    return false;
//	    }

//    	if ((month==4 || month==6 || month==9 || month==11) && day==31)
//	    {
//    	    return false;
//	    }

//    	if (month == 2) // check for february 29th
//	    {
//    	    var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
//        	if (day > 29 || (day==29 && !isleap))
//	        {
//    	         return false;
//        	}
//	    }

//    	return true; // date is valid
//	}//function isDate(dateStr)

 function  imageupload(stringvalue)
   {
    var msg="";
    var returnvalue = false;
    if(trimAll(stringvalue) !="")
    {     
            var  ext =  stringvalue;
            if(ext.length > 0)
            {
            ext = ext.substring(ext.length-3,ext.length);
            ext = ext.toLowerCase();
            
             if(ext != "jpg" && ext !="gif" && ext != "jpeg" )
              {
              returnvalue= false;
               }else
               {
               returnvalue= true;
               }
             }  
       }     
          return returnvalue;  
    }
    function  pptupload(stringvalue)
   {
    var msg="";
    var returnvalue = false;
    
    if(trimAll(stringvalue) !="")
    {    
            var  ext =  stringvalue;
            
            if(ext.length > 0)
            {
          //  ext = ext.substring(ext.length-3,ext.length);
            ext = ext.toLowerCase();
            var extlength= stringvalue.lastIndexOf(".")  
        
            var  ext = ext.substring(parseInt(extlength)+1,ext.length);
        
             if(ext != "ppt" && ext != "pptx" )
              {
              returnvalue= false;
               }
               else
               {
               returnvalue= true;
               }
             }  
       }     
          return returnvalue;  
    }
  
    function  reportupload(stringvalue)
   {
    var msg="";
    var returnvalue = false;
    if(trimAll(stringvalue) !="")
    {     
            var  ext =  stringvalue;
            if(ext.length > 0)
            {
            ext = ext.substring(ext.length-3,ext.length);
            ext = ext.toLowerCase();
            
             if(ext != "doc" && ext !="pdf" && ext !="rtf" && ext !="zip" && ext != "docx")
              {
              returnvalue= false;
               }
               else
               {
               returnvalue= true;
               }
            }  
       }
      return returnvalue;  
   }
  
     function  reportuploaddocx(stringvalue)
   {
    var msg="";
    var returnvalue = false;
    if(trimAll(stringvalue) !="")
    {     
            var  ext =  stringvalue;
            if(ext.length > 0)
            {
            ext = ext.substring(ext.length-4,ext.length);
            ext = ext.toLowerCase();
            
             if(ext != "docx")
              {
              returnvalue= false;
               }
               else
               {
               returnvalue= true;
               }
            }  
       }
      return returnvalue;  
   }
  
  
  
  
  function CheckAll(spanChk)
{
   
     var oItem = spanChk.children;
    var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
    xState=theBox.checked;

    elm=theBox.form.elements;
    for(i=0;i<elm.length;i++)
    if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
    {
    //elm[i].click();
    if(elm[i].checked!=xState)
    elm[i].click();
//    if(document.getElementById("chkselectall"))
//    {
//    document.getElementById("chkselectall").checked = false;
//    }
    //elm[i].checked=xState;
    }
 }
  

function textboxMultilineMaxNumber(str,maxLen){
try
{
    if(str.length > (maxLen-1))
    {
    return 0;
    }
    else
    {
        return 1;
    }
}
catch(e)
{
}
}

 function checkWebUrl(theUrl)
    {    
      var incomingvalue="http://"+theUrl.value.replace("http://","");             
      if(incomingvalue.match(/^(http|ftp)\:\/\/\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#]\w+)*\/?$/i) ||
         incomingvalue.match(/^mailto\:\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w{2,4}$/i))
         {
        return true;
        }
        else
         {
         return false;
        }
    }
    


   function textCounter(field,counter,maxlimit,prbar)
    {
    
  //  alert(prbar);
	// text width//
	    var fieldWidth =  parseInt(field.offsetWidth);
	    var charcnt = field.value.length;        

	    // trim the extra text
	    if (charcnt > maxlimit)
	     { 
		    field.value = field.value.substring(0, maxlimit);
	    }

	    else
    	
	     { 
	   
	     
	    if(prbar == "yes")
	    {
	   
	   // progress bar percentage
	    var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	    document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	    document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
	   // color correction on style from CCFFF -> CC0000
	     setcolor(document.getElementById(counter),percentage,"background-color");
	    }
	    
	    }
}


function setcolor(obj,percentage,prop)
{
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}


  function opengoogle(address,city,state,zip)
{
    
    window.open('http://maps.google.com/maps?hl=en&q='+address +','+city+ ',' + state +',' + zip);
}

function HandleImageSwap(source)
{ 
    tmpImage = new Image();
    tmpImage.src = source;   
   
     var filename = source.substring(source.lastIndexOf('/')+1,source.length);
     if(filename != "imagepending.gif")
     {
      document.getElementById('Image_bigphoto').style.visibility="hidden"
    setTimeout('imgDisplay(tmpImage)',100);
    document.getElementById('Image_bigphoto').style.visibility="visible"
    }   
}
function imgDisplay(img)
{
 
//    if(img.width == 250)
//    {width =250;
//    }
//    else
//    {
//        width = img.width;
//    }
    	//alert(width);
    	//alert(img.height);
    document.getElementById('Image_bigphoto').src = img.src;
    document.getElementById('Image_bigphoto').width = img.width;
    document.getElementById('Image_bigphoto').height = img.height;
}


function getPrinthead(strid,usertype,pagetype)
{	
            var year = now.getYear();
			//Creating new page
			if(pagetype=='pocard')
			{
			var pp = window.open('','','left=0,top=0,width=700,height=550,toolbar=0,resizable=no scrollbars=yes');
			}
			else 
			{
			var pp = window.open('','','left=0,top=0,width=500,height=100,toolbar=0,resizable=yes scrollbars=yes');
			}
			//Adding HTML opening tag with <HEAD> … </HEAD> portion 
			pp.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">')
			pp.document.writeln('<HTML><HEAD><title>Print Preview</title><LINK href=../CPOHstyle.css  type="text/css" rel="stylesheet">')
		   	pp.document.writeln('<LINK href="../ScreenStyle.css"  type="text/css" rel="stylesheet" ><base target="_self">')
	
		    //Adding style sheet to hide print and close buttons
			pp.document.writeln('<LINK href="../PrintStyle.css"  type="text/css" rel="stylesheet" media="print"><base target="_self"></HEAD>')
		
			//Adding Body Tag
			pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0" bgcolor="white" onload=window.focus()>');
			//Adding form Tag
			pp.document.writeln('<form>');
		    //Writing print area of the calling page
		     if(usertype != "seller" && usertype != "buyer" && usertype != "realtor" && pagetype!="pocard")
		     {
		        pp.document.writeln('<TABLE width=100% align="center"><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINTINS1" type="image" src="../Images/print_i.jpg" onclick="javascript:location.reload(false);window.print();">&nbsp;&nbsp;&nbsp;<Input ID="CLOSEINS1" type="image" src="../Images/close_i.jpg" onclick="javascript:location.reload(false);window.close();"></TD></TR></TABLE>');
		      }
		    pp.document.writeln('<table width=100% >');
		    
			    pp.document.writeln('<br><BR>');
              
		   // pp.document.writeln('<tr><td align="center" colspan="3"><font face="verdana" size="2" ><b> '+heading+'</b>');
//		  	pp.document.writeln('<br>');
			pp.document.writeln('<TR><td  colspan="3"  valign="top">');
			pp.document.writeln("<table width=80% align=center><tr><td >"+document.getElementById(strid).innerHTML+'</td></tr></table>');
		    pp.document.writeln('</td></tr>');
		
		    pp.document.write('<script>');
		    pp.document.write('if(document.getElementById("tdpage1")){document.getElementById("tdpage1").style.display="block";}');
		    pp.document.write('if(document.getElementById("tdpage2")){document.getElementById("tdpage2").style.display="block";}');
		     pp.document.write('if(document.getElementById("tdpage3")){document.getElementById("tdpage3").style.display="block";}');
		       pp.document.write('if(document.getElementById("tdpage4")){document.getElementById("tdpage4").style.display="block";}');
		         pp.document.write('if(document.getElementById("tdpage5")){document.getElementById("tdpage5").style.display="block";}');
		           pp.document.write('if(document.getElementById("tdpage6")){document.getElementById("tdpage6").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage7")){document.getElementById("tdpage7").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage8")){document.getElementById("tdpage8").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage9")){document.getElementById("tdpage9").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage10")){document.getElementById("tdpage10").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage11")){document.getElementById("tdpage11").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage12")){document.getElementById("tdpage12").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage13")){document.getElementById("tdpage13").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage14")){document.getElementById("tdpage14").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage15")){document.getElementById("tdpage15").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage16")){document.getElementById("tdpage16").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage17")){document.getElementById("tdpage17").style.display="block";}');
		             pp.document.write('if(document.getElementById("tdpage18")){document.getElementById("tdpage18").style.display="block";}');
		        pp.document.write('objLinks = document.getElementsByTagName("A");');
		       
		        pp.document.write('for(i=0;i<objLinks.length;i++){objLinks[i].disabled = true;objLinks[i].href=' + '"#"' + ';objLinks[i].removeAttribute(' + "'target'" + ');objLinks[i].onclick=' + '"#"' + ';}');
    		        	
		        if(pagetype=='slviewhome')
		        {
		           pp.document.write('if(document.getElementById("tblbuyerdiv")){document.getElementById("tblbuyerdiv").className='+'"buyertableclass"'+'};')
		            pp.document.write('if(document.getElementById("img_inslogo")){document.getElementById("img_inslogo").disabled= true;}');
		            pp.document.write('if(document.getElementById("img_agentphoto")){document.getElementById("img_agentphoto").disabled=true;}');
		            pp.document.write('if(document.getElementById("ddl_agentphoto")){document.getElementById("ddl_agentphoto").disabled=true;}');
		            pp.document.write('if(document.getElementById("RadioButtonList1")){document.getElementById("RadioButtonList1").onclick=' + '"#"' + '}');
		              pp.document.write('if(document.getElementById("ChkSelectall")){document.getElementById("ChkSelectall").onclick=' + '"#"' + '}');
		            pp.document.write('objImageLinks = document.getElementsByTagName("IMG");'); 
		    	     
		    	    pp.document.write('for(i=0;i<objImageLinks.length;i++){objImageLinks[i].onclick=' + '"#"' + ';objImageLinks[i].setAttribute(' + "'onmouseover','' " + ');}');
		    	        pp.document.write('for(i=0;i<objImageLinks.length;i++){objImageLinks[i].onclick=' + '"#"' + ';objImageLinks[i].setAttribute(' + "'onmouseout','' " + ');}');
		    	      
		   	    }
    		    	
		    pp.document.write('</script>');
		    pp.document.writeln('<tr><td colspan="3" align="center">');
		    //Creating two buttons Print and Close within a table
		    if(usertype == "buyer")
		    {
		    pp.document.writeln('<TABLE width=100% ><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINTBUYER" type="image" src="../Images/print_i.jpg" onclick="javascript:location.reload(false);window.print();">&nbsp;&nbsp;&nbsp;<Input ID="CLOSEBUYER" type="image" src="../Images/close_i.gif" onclick="javascript:location.reload(false);window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
		    }
		    else if(usertype == "seller")
		    {
		    //alert('seller');
		    pp.document.writeln('<TABLE width=100% align="center"><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINTSELLER" type="image" src="../Images/print_i.jpg" onclick="javascript:location.reload(false);window.print();">&nbsp;&nbsp;&nbsp;<Input ID="CLOSESELLER" type="image" src="../Images/close_i.jpg" onclick="javascript:location.reload(false);window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
			
			}
			else if(usertype == "realtor")
		    {
			pp.document.writeln('<TABLE width=100% align="center"><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINTREALTOR" type="image" src="../Images/print_i.jpg"  align="center" onclick="javascript:location.reload(false);window.print();">&nbsp;&nbsp;&nbsp;<Input  align="center" ID="CLOSEREALTOR" type="image" src="../Images/close_postcard_i.gif" onclick="javascript:location.reload(false);window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
			}
			else 
		    {
		    
			pp.document.writeln('<TABLE width=100% align="center"><TR><TD align=center><Input  ID ="PRINTINS" type="image" src="../Images/print_i.jpg" onclick="javascript:location.reload(false);window.print();">&nbsp;&nbsp;&nbsp;<Input ID="CLOSEINS" type="image" src="../Images/close_i.jpg" onclick="javascript:location.reload(false);window.close();"></TD></TR></TABLE>');
			}
//			pp.document.writeln('<TABLE width=100% align="center"><TR><TD></TD></TR><TR><TD class="style10" style="color:blue">&copy;&nbsp;' + year + '&nbsp;<a href="http://www.certifiedpreownedlisting.com" target="_blank" style="color:blue">CPOF</a>. All Rights Reserved. </TD></TR></TABLE>');
			pp.document.writeln('</td></tr>');			
			pp.document.writeln('</table>');
			pp.document.writeln('</form></body></HTML>');		
			pp.document.close();	
			
}

function isChklistSelected(chkctrl)
{
    var checked=0;
    var cl=document.getElementById(chkctrl);
    var ac= cl.getElementsByTagName("input");
    for(var i=0;i<ac.length;i++)
    {
        if(ac[i].checked)
        {
            checked=1;
        }
    }
    if(checked==0)
    {
        return false;
    }
    else
    {
        return true;
    }
    
}
// canada postal code
	function fValidatePostalCode(objPostalCode, objPCtext) //a1a 1s1
	{
		var digits = "0123456789"
		var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
		var strPostalCode;
		var strPostalCode2;

		strPostalCode = trimAll(objPostalCode).toUpperCase();
		objPostalCode.value = strPostalCode; //A1A 1S1
		
		if (strPostalCode.length == 7)
		{
			strFourthChar = strPostalCode.substr(3,1);
			if ((strFourthChar != " ") && (strFourthChar != "-"))
			{
    			return false;
			}
			else
			{
				if (strFourthChar == " ")
				{
					strPostalCode2= strPostalCode.replace(" ", "");
				}
				else 
				{
					strPostalCode2 = strPostalCode.replace("-", "");
				}
		    	strPostalCode = strPostalCode2;
			}
		}

		if(strPostalCode.length != 6 )
		{
			return false;
		}

		if((letters.indexOf(strPostalCode.charAt(0)) < 0) || (letters.indexOf(strPostalCode.charAt(2)) < 0) || (letters.indexOf(strPostalCode.charAt(4)) < 0) )
		{
			return false;
		}
		else if((digits.indexOf(strPostalCode.charAt(1)) < 0) || (digits.indexOf(strPostalCode.charAt(3)) < 0) || (digits.indexOf(strPostalCode.charAt(5)) < 0) )
		{
			return false;
		}

	 return true;
	}
	
//    function fTrim(sWord)
//	{
//		//trim spaces from the front

//		if(sWord == "")
//		{
//			return "";
//		}

//		while(sWord.charAt(0) == " ")
//		{
//			if(sWord.length > 1)
//			{
//				sWord = sWord.substr(1, sWord.length);
//			}
//			else
//			{
//				return "";
//			}
//		}
//		while(sWord.charAt(sWord.length-1) == " ")
//		{
//			sWord = sWord.substr(0, sWord.length - 1);
//		}
//		
//		return sWord;

//	}
function IsRadioButtonListSelected(rdList)
    {    
	if(rdList.getElementsByTagName("input"))
	{
	
	    var arrrdllist1 =rdList.getElementsByTagName("input");
            var count1=0;
    	
            for (i=0;i<arrrdllist1.length;i++)
            {
          
              if(arrrdllist1[i].checked)
              {
                count1 = count1+1;
              }
           }
           if(count1 == 0)
           {
             return false;
           } 
           else
           {
	            return true;
           }		
       }
  }
  
  function DisplayPackagename(packid)
  {
    var retpack="";
      if(packid=="1")
      {
      retpack = "Silver";
      }
     else if(packid=="2")
      {
      retpack = "Gold";
      }
    else  if(packid=="3")
      {
      retpack = "Platinum";
      }
   
      return retpack;
  }
  
  function isFourPtChklistSelected(chkctrl)
{
    var checked=0;
    //var cl=document.getElementById(chkctrl);
    
    var ac= chkctrl.getElementsByTagName("input");
    for(var i=0;i<ac.length;i++)
    {
        if(ac[i].checked)
        {
            checked=1;
        }
    }
    if(checked==0)
    {
        return false;
    }
    else
    {
        return true;
    }
}
 function zipcodetoradius(ddlcountry, txtzip, txtpostal, ddlradius)
    {
    if(document.getElementById(ddlcountry).value=="1")
    {
        if(document.getElementById(txtzip).value.length=="5")
        {
             document.getElementById(ddlradius).value="20";
        }
        else
        {
             document.getElementById(ddlradius).value="0";
        }
    }
    else
    {
          document.getElementById(ddlradius).value="0";
    }
    }
function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
  } 
  // for four point
  function selectintunit(rblhvacintzone,radiobuttonint)
     {
        if(document.getElementById(rblhvacintzone).checked == true)
        {
           document.getElementById(radiobuttonint).checked=true;
        }
        else
        {  
          document.getElementById(radiobuttonint).checked=false;
        }
     }

//Script created by Jim Young (www.requestcode.com)
//Submitted to JavaScript Kit (http://javascriptkit.com)
//Visit http://javascriptkit.com for this script

//Set the tool tip message you want for each link here.
     var tip=new Array
           tip[0]='The Silver CPOF Package includes a basic, 4-point inspection covering the Roof, Electrical System, Plumbing System and HVAC System. This package offers sellers the benefits of having their home Certified Pre-Owned at a very reasonable price. Silver Packages appear online in random order below Gold and Platinum Packages.'

           tip[1]='The Gold CPOF Package includes a FULL home inspection covering all the systems and components of the home. This package is reasonably priced and offers sellers complete knowledge of their home’s condition. Gold Packages appear online in random order below Platinum Packages but above Silver Packages. '
           tip[2]='The Platinum CPOF Package includes a FULL home inspection covering all the systems and components of the home AND a WDO/WDI inspection. This package is the best value for sellers as it provides the most comprehensive disclosure. Platinum Packages appear online in random order above all other Packages.'
   
     function showtip(current,e,num)
        {
     
         if (document.layers) // Netscape 4.0+
            {
             theString="<DIV CLASS='ttip'>"+tip[num]+"</DIV>"
             document.tooltip.document.write(theString)
             document.tooltip.document.close()
             document.tooltip.left=e.pageX+14
             document.tooltip.top=e.pageY+2
             document.tooltip.visibility="show"
            }
         else
           {
            if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
              {
              
                if(document.getElementById("tooltip"))
                {
               elm=document.getElementById("tooltip")
               }
               
               else
               {
               elm=document.getElementById("indextooltip")
               }
               elml=current
               elm.innerHTML=tip[num]
               elm.style.height=elml.style.height
               elm.style.top=parseInt(elml.offsetTop+elml.offsetHeight)
               elm.style.left=parseInt(elml.offsetLeft+elml.offsetWidth)
               elm.style.visibility = "visible"
              
             
              }
           }
        }
        
function hidetip(){
if (document.layers) // Netscape 4.0+
   {
    document.tooltip.visibility="hidden"
   }
else
  {
   if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
     {
      elm.style.visibility="hidden"
     }
  } 
}

//// date validation from 01/01/1753 to 12/31/9999

var dtCh= "/";
var minYear=1753;
 var now = new Date();
 var maxYear=now.getFullYear();
//var maxYear=9999;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){

	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
//		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
//		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
//		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
	
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
//		alert("Please enter a valid date")
		return false
	}
return true
}

//method for date range validation (ie) from date and to date
function ValidateDateRange(txtDate){
	var dt=txtDate
	
	if (isDate(dt)==false){
		
		return false
	}
    return true
 }
 
// website validation
 function checkUrl(theUrl)
 {
var arr = new Array(
'.com','.net','.org','.biz','.coop','.info','.museum','.name',
'.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',
'.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',
'.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',
'.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',
'.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',
'.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',
'.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',
'.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',
'.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',
'.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',
'.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',
'.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',
'.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',
'.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',
'.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',
'.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',
'.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',
'.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',
'.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',
'.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',
'.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',
'.wf','.ye','.yt','.yu','.za','.zm','.zw');

var mai = theUrl;
var val = true;

var dot = mai.lastIndexOf(".");
var dname = mai.substring(0,dot);
var ext = mai.substring(dot, mai.length);
	
if(dot>2 && dot<57)
{
	for(var i=0; i<arr.length; i++)
	{
	  if(ext == arr[i])
	  {
	 	val = true;
		break;
	  }	
	  else
	  {
	 	val = false;
	  }
	}
	if(val == false)
	{	  	
	    return false;
	}
	else
	{
		for(var j=0; j<dname.length; j++)
		{
		  var dh = dname.charAt(j);
		  var hh = dh.charCodeAt(0);
		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
		  {
			 if((j==0 || j==dname.length-1) && hh == 45)	
		  	 {		 	  	
			      return false;
		 	 }
		  }
		  else
		  {		  	
			 return false;
		  }
		}
	}
}
else 
{
    return false;
}

//return true;
}

//function checkyear(yearString)
// {
//        var now = new Date();
//     
//		if(yearString > now.getYear())
//		{
//	
//		return 0;
//		}
//	    else
//		{
//		    return 1;
//		}	
//}

//valid year built validation

function checkyear(inputtext)
{
 var min=1753;
 var now = new Date();
 var max=now.getYear();

if(inputtext<=max && inputtext>min)
{
return 1;
}
else
{
return 0;
}
}

function chkpdf()
{
var p;
try {
//p = new ActiveXObject('AcroExch.Document');
//p = new ActiveXObject('AcroPDF.PDF');
}
catch (e) {
// active x object could not be created
//alert("Please install adobe acrobat to view the summary");
return true;

}
}

//var chk=0;
//var chk1=0;
//var chk2=0;
//var p;
//try {
//p = new ActiveXObject('AcroPDF.PDF');
//chk=0;
//}
//catch (e) {
//// active x object could not be created
//chk=1;
//}

////2nd type

//var isInstalled = false;
//var version = null;
//if (window.ActiveXObject) {
//    var control = null;
//    if (!control) {
//        try {
//            // PDF.PdfCtrl is used by version 6 and earlier
//            control = new ActiveXObject('PDF.PdfCtrl');
//            chk1=0;
//        } catch (e) {          
//            
//            chk1=1;
//        }
//    }
//    if (control) {
//        isInstalled = true;
//        version = control.GetVersions().split(',');
//        version = version[0].split('=');
//        version = parseFloat(version[1]);
//        chk2=0;
//    }
//} else {
//    // Check navigator.plugins for "Adobe Acrobat" or "Adobe PDF Plug-in"*
//   
//    chk2=1;
//}
//if(chk != 0 && chk1 != 0 && chk2 != 0)
//{
//alert('Please install adobe acrobat to view the summary');
//return false;
//}
//return true;
//}

//for  radiobutton double click
function resetrblvalues(rbl)
{

rbl.checked = false;

}

var n;
var p;
var p1;
function ValidatePhone(m){
p=p1.value
if(p.length==3){
	//d10=p.indexOf('(')
	pp=p;
	d4=p.indexOf('(')
	d5=p.indexOf(')')
	if(d4==-1){
		pp="("+pp;
	}
	if(d5==-1){
		pp=pp+")";
	}
	//pp="("+pp+")";
	
	document.getElementById(n).value="";
	document.getElementById(n).value=pp;

}
if(p.length>3){
	d1=p.indexOf('(')
	d2=p.indexOf(')')
	if (d2==-1){
		l30=p.length;
		p30=p.substring(0,4);
		//alert(p30);
		p30=p30+")"
		p31=p.substring(4,l30);
		pp=p30+p31;
		//alert(p31);
			document.getElementById(n).value="";
	document.getElementById(n).value=pp;
		
	}
	}
if(p.length>5){
	p11=p.substring(d1+1,d2);
	if(p11.length>3){
	p12=p11;
	l12=p12.length;
	l15=p.length
	//l12=l12-3
	p13=p11.substring(0,3);
	p14=p11.substring(3,l12);
	p15=p.substring(d2+1,l15);
	
	document.getElementById(n).value="";
	
	pp="("+p13+")"+p14+p15;
	document.getElementById(n).value=pp;
	
	//obj1.value="";
	//obj1.value=pp;
	}
	l16=p.length;
	p16=p.substring(d2+1,l16);
	l17=p16.length;
	if(l17>3&&p16.indexOf('-')==-1){
		p17=p.substring(d2+1,d2+4);
		p18=p.substring(d2+4,l16);
		p19=p.substring(0,d2+1);
		//alert(p19);
	pp=p19+" "+p17+"-"+p18;
	document.getElementById(n).value="";
	document.getElementById(n).value=pp;
	
	//obj1.value="";
	//obj1.value=pp;
	}
}
//}
setTimeout(ValidatePhone,100)
}
function getIt(m){
n=m.name;

//p1=document.forms[0].elements[n]
p1=m
ValidatePhone(n)
}

 function validateUSPhone( strValue ) {

  var objRegExp  = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;

  //check for valid us phone with or without space between
  //area code
  return objRegExp.test(strValue);
   if(!objRegExp.test(strValue))
    return false; //doesn't match pattern, bad date
  else{
  return true;}
}


function GetTerms()
{

lblTermsAndCdtns.innerHTML ="";

    var scripts = new Array();
    scripts[0] = "1.	By purchasing these inspection reports, licensee understands that their license if for their sole exclusive use for the home or homes they are purchasing.";
    scripts[1] = "2.	Licensed users understand that these survey reports are owned entirely, including copyright privileges, by the inspector, Inspection Company, certified pre owned foreclosure, its proprietors or a combination of all.";
    scripts[2] = "3.	Licensed users understands that these reports cannot be copies or forwarded to anyone other than those representatives associated with the homes being considered for purchase. Licensee has sole responsibility to advise any representative, including Realtors, Insurance agents, lenders etc. of the conditions of this report under this license.";
    scripts[3] = "4.	Licensed users understands that under no circumstance must copies of reports be forwarded digitally to any third party such as realtor, mortgage company or agent, banking institution, for any other purpose other than for the sole exclusive purpose of the transaction or sale for which the survey was conducted for and with the licensed buyer/investor.";
    scripts[4] ="5.	    Licensed users understands the strict confidentiality of these survey reports and only approved registered users are licensed to view these inspection reports.";
     scripts[5] ="6.	Investor takes full responsibility for the security of this information and the costs associated with intentional misuse of this information. ";
      scripts[6] ="7.	Licensed users understand that these surveys are limited in nature only and are not either full home inspection reports or technically exhaustive reports. No guarantee or warranty is offered with these surveys either expresses or implied and all data collected is based on the inspection type in question on those visual and accessible components available at the time of survey only. No invasive or destructive testing or other specialist testing was conducted as part of these surveys and where licensed users are concerned with the quality of any component of the environmental conditions they are advised to conduct their own full detailed inspection with regard to the same.";
       scripts[7] ="8.	Licensed user understands that these reports and the Certified Pre Owned Foreclosure program was developed as a process of risk minimization and not risk elimination. Licensed user agrees to hold harmless inspector, inspection company, inspection Depot and its affiliates to any and all claims associated with the purchase and sale of related homes and subsequent survey reports.";
        scripts[8] ="9.	Licensed user understands that the only recourse for damages is the return of the fee paid for the survey report in question from the inspector or inspection company only if it is proven that reports have been erroneously prepared.";
         scripts[9] ="10.	Licensed user accepts full responsibility for additional costs associated with breach of any of the conditions above and agrees to pay inspector/inspection company the entire fee for the inspection which is a minimum of $500.";
         
    

    for (i=0;i<scripts.length;i++)
    {
   
    lblTermsAndCdtns.innerHTML = lblTermsAndCdtns.innerHTML+scripts[i] + "<br ><br>";
    } 
      var x= $find("modalExtndTerms");
        if(x)
        {        
           x.show(); 
          return false;
        }
}

function CheckFinalTerms()
{


        var x= $find("modalExtndTerms");
        if(x)
        {
       
            x.hide();             
        }


}
