<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function singleBuy(URL){
    root = window.location.href.replace("http://", "").split("/");
    root = !root[1]?"http://"+ root[0] +"":"http://"+ root[0] +"/";
    var newURL = root+"/singlebuy.php?prodid="+URL;
    aWindow=window.open(newURL,'','width=770,height=500,toolbar=no,status=no,scrollbars=yes,menubars=no, resizable=yes');
}

function addItem(URL){
        root = window.location.href.replace("http://", "").split("/");
    root = !root[1]?"http://"+ root[0] +"/":"http://"+ root[0] +"/";

    var newURL = root+"item.php?action=add&prodid="+URL;
    aWindow=window.open(newURL,'Shop','width=770,height=500,toolbar=no,status=no,scrollbars=yes,menubars=no, resizable=yes');
}

function viewCart(URL){
    //root = window.location.href.replace("http://", "").split("/");

    //root = !root[1]?"http://"+ root[0] +"":"http://"+ root[0] +"/";
    //var url2 = window.location.href;
    //var root = url2.substring(0,url2.lastIndexOf('/'));
    var newURL = "http://www.built2go.com/cart_pop.php";
    aWindow=window.open(newURL,'','width=770,height=500,toolbar=no,status=no,scrollbars=yes,menubars=no, resizable=yes, location=no');
}

function valid_user(form) {
   f = form;

   for(var i=0;i<f.elements.length;i++){
       if (f.elements[i].type!="text" && f.elements[i].type!="password"){
           continue;
       }
       t = f.elements[i].value;

       if(t == null || t.length == 0 && f.elements[i].name != "addy2"){
           var et = f.elements[i].getAttribute("errortext");
           alert(et);
           f.elements[i].focus();
           return false;
       }
   }


  if (!f.agr.checked)	{
     var et = f.agr.getAttribute("errortext");
           alert(et);
           f.agr.focus();
     return false;
	}

return true;
}

function vrenew(form) {
   f = form;

   for(var i=0;i<f.elements.length;i++){
       if (f.elements[i].type!="text" && f.elements[i].type!="password"){
           continue;
       }
       t = f.elements[i].value;

       if(t == null || t.length == 0){
           var et = f.elements[i].getAttribute("errortext");
           alert(et);
           f.elements[i].focus();
           return false;
       }
   }
return true;
}

function RCheck(form) {
   f = form;

   for(var i=0;i<f.elements.length;i++){
       if (f.elements[i].type!="text" && f.elements[i].type!="password"){
           continue;
       }
       t = f.elements[i].value;

       if(t == null || t.length == 0 && f.elements[i].name != "subscribe"){
           var et = f.elements[i].getAttribute("errortext");
           alert(et);
           f.elements[i].focus();
           return false;
       }
   }
   
   if (!f.agr.checked)	{
     var et = f.agr.getAttribute("errortext");
           alert(et);
           f.agr.focus();
     return false;
	}
return true;
}
//-->
function confirm_del(ID) {
	pmbox=confirm("Are you sure you want to delete this item from your cart?");
	if (pmbox==true) { // Output when OK is clicked
        window.location=root+"/item.php?action=delete&id="+ID;
	} else {
	// Output when Cancel is clicked
	return false;
	}
}
function valid_cc(form) {
   f = form;
   var x_country_tag = form.CountryName.value;
   for(var i=0;i<f.elements.length;i++){
       if (f.elements[i].type!="text" && f.elements[i].type!="password"){
           continue;
       }
       t = f.elements[i].value;

       if(t == null || t.length == 0 && f.elements[i].name != "x_company" && f.elements[i].name != "Street2"){
           var et = f.elements[i].getAttribute("errortext");
           alert(et);
           f.elements[i].focus();
           return false;
       }
   }
   	if (x_country_tag == 0)
    	{
       alert("You need to pick your country.");
       form.CountryName.focus()
    	 return false;
    	}

return true;
}

function checkdomain(form) {
   f = form;
  
   for(var i=0;i<f.elements.length;i++){
       if (f.elements[i].type!="text" && f.elements[i].type!="password"){
           continue;
       }
       t = f.elements[i].value;

       if(t == null || t.length == 0){
           var et = f.elements[i].getAttribute("errortext");
           alert(et);
           f.elements[i].focus();
           return false;
       }
   }
   if (!f.agr.checked)	{
     var et = f.agr.getAttribute("errortext");
           alert(et);
           f.agr.focus();
     return false;
	}
return true;
}
function openwin(winurl) {
   newwin = window.open(winurl,'Enlarge','width=620,height=500,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
   newwin.focus();
}

function valid_email(form) {
var name_tag = form.email.value;

    if (!name_tag)
    {
     alert("You need to type your email address in.");
       return false;
    }

return true;
}
function addField( area,iclass ) {
       
        if( !document.getElementById ) return ; // Only DOM browsers

        var field_area = document.getElementById( area ) ;
        var lastRow = field_area.rows.length ;
        var iteration = lastRow ;
        var row = field_area.insertRow( lastRow ) ;

        // Cells
        var cellLeft = row.insertCell(0) ;

        var count = lastRow - 1 ;

        // alert('lastRow is '+lastRow+' iteration is '+iteration+' row is '+row+' count is '+count ) ;

        if( count > 7) {alert('You have no licenses remaining in your account. Please purchase additional licenses or renew your account'); return ;}
       
        if( document.createElement ) { //W3C Dom method.
                var file = document.createElement('input') ;
                //file.style.font ='Tahoma 11px';


                file.name = 'client_url[]' ;
                file.type = 'text' ;
                cellLeft.appendChild( file ) ;
        }
}
function toggle_collapse(objid)
{

	obj = document.getElementById(objid);
	img = document.getElementById("collapseimg_" + objid);
	if (obj.style.display == "none")
	{
		var itemcol = '';
        obj.style.display = "";
        img.src = 'images/icon_minus.gif';
	}
	else
	{
		var itemcol = 'display:none';
        obj.style.display = "none";
        img.src = 'images/icon_cross.gif';
	}
	return false;
}
