
 function SitePagesBg(bgfile, bgpos, bgw) {

    SiteHeight(bgpos, bgw);

    document.getElementById("SiteBg").style.backgroundImage = "url('"+bgfile+"')";
    document.getElementById("SiteBg").style.backgroundRepeat = "no-repeat";

 } // end function


 function SiteHeight(bgpos, bgw) {
 
    var pdim = BrwoserWidthHeight();
    
    document.getElementById("ContentMain").style.height = pdim.h+'px';
 
    bgwn = parseFloat(bgw);
       
    v1 = pdim.w - 800;
    v2 = v1 / 2;
    v3 = bgwn / 2;
    v4 = 800 - v3;
    v5 = v2 + v4;
    
    
    document.getElementById("SiteBg").style.backgroundPosition = v5 + "px " + bgpos;
 
 } // end function
 

 function ListingNav(v, n) {
 
   document.location.href = v + "&pagenumber=" + n;
 
 } // end function


 function ContactUsSend() {
 
    var err = 0;

    fname = document.contact_us.name.value;
    femail = document.contact_us.email.value;
    fmessage = document.contact_us.message.value;
    
    c1 = "4D4D4D";
    c2 = "4D4D4D";
    c3 = "4D4D4D";
    
    if(Remove_Spaces(fname) == "") {
       c1 = "800800";
       err++;
    }

    if(Remove_Spaces(femail) == "" || Validation_Email(femail) == false) {
       c2 = "800800";
       err++;
    }

    if(Remove_Spaces(fmessage) == "") {
       c3 = "800800";
       err++;
    }

    document.getElementById("FField0").style.color = "#" + c1;
    document.getElementById("FField1").style.color = "#" + c2;
    document.getElementById("FField2").style.color = "#" + c3;

	if(err == 0) {	    
	    ffields = 'data=contact_us';
	    ffields += '&cfdata=' + escape(document.getElementById("cfdata").value);
	    ffields += '&name=' + escape(fname);
	    ffields += '&email=' + escape(femail);
	    ffields += '&message=' + escape(fmessage);
		ContactUsSendMsg(ffields);
	}
	
 } // end function


 function ContactUsSendMsg(ffields) {

    CFA = document.getElementById("ContactUsFormArea");
    
    CFA.innerHTML = "<img src='graphics/loader.gif' /> <br />Please wait!";    

	var doPagesContent = function(doPagesContentResponse) {

        contact_us_ResponseTextarr = doPagesContentResponse.split("###Result###");
        
        CFA.innerHTML = contact_us_ResponseTextarr[1];

	} // end 
	
	oAjax.doPost('content.php', ffields, doPagesContent, 'text');

 } // end function


 function getSubContentPages(mp, pitem) {

    ffields = 'data=' + mp + '&sub=' + pitem;
 
    SCA = document.getElementById("SubContentArea");

    SCA.innerHTML = "<img src='graphics/loader.gif' />";  
    
    ssmp = document.getElementById("SelectedSubMenuPage").innerHTML;
    
    if(ssmp != "0") {
       ssmpObj = document.getElementById("sp" + ssmp);
       
       if(ssmpObj)
          ssmpObj.className = "SubMenu"
          
    } // end if
    
    document.getElementById("SelectedSubMenuPage").innerHTML = pitem;
    
    document.getElementById("sp" + pitem).className = "SubMenuSel";

	var doPagesContent = function(doPagesContentResponse) {

        SCA.innerHTML = doPagesContentResponse;

	} // end 
	
	oAjax.doPost('content.php', ffields, doPagesContent, 'text');

 } // end function


 function Graphs(img) {
 
     opts = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ";
     opts += "copyhistory=no, width=630, height=500"
    
     window.open("popup.php?page=graphs&sub=" + img,"_blank",opts);
 
 } // end function
 
 
 function PagePrint(v) {
 
    document.getElementById("PopupPageOptions").style.display = v;
 
 } // end function



 function ProductsSubsCategories(v) {
 
    document.getElementById("ProductsSubCategoryItemsList").innerHTML = "&nbsp;";    

    if(v == "0")
       document.getElementById("ProductsSubCategoryList").innerHTML = "&nbsp;";
    else
       ProductsSubsCategoriesProc(v);
       
 } // end function
 
 
 function ProductsSubsCategoriesProc(v) {
 
   PSCL = document.getElementById("ProductsSubCategoryList");

   PSCL.innerHTML = "<img src='graphics/loader.gif' />";

	var doPagesContent = function(doPagesContentResponse) {
        
        PSCL.innerHTML = doPagesContentResponse;
            	      
	} // end 
	
	oAjax.doPost('content.php', 'data=products_subs&mpci=' + v,doPagesContent, 'text');

 } // end function


 function ProductsSubsCategoriesItems(v) {
 
    if(v == "0")
       document.getElementById("ProductsSubCategoryItemsList").innerHTML = "&nbsp;";
    else   
       ProductsSubsCategoriesItemsProc(v);
       
 } // end function
 
 
 function ProductsSubsCategoriesItemsProc(v) {
 
   PSCL = document.getElementById("ProductsSubCategoryItemsList");

   PSCL.innerHTML = "<img src='graphics/loader.gif' />";

	var doPagesContent = function(doPagesContentResponse) {
        
        PSCL.innerHTML = doPagesContentResponse;
            	      
	} // end 
	
	oAjax.doPost('content.php', 'data=products_items&spci=' + v,doPagesContent, 'text');

 } // end function


 function ProductItemContent(v) {
 
    if(v != "0")
       ProductItemContentProc(v);
 
 } // end function


 function ProductItemContentProc(v) {
 
   PSCL = document.getElementById("SelectedItemContent");

   PSCL.innerHTML = "<img src='graphics/loader.gif' />";

	var doPagesContent = function(doPagesContentResponse) {
        
        PSCL.innerHTML = doPagesContentResponse;
            	      
	} // end 
	
	oAjax.doPost('content.php', 'data=products_conts&ipci=' + v,doPagesContent, 'text');

 } // end function


 function ProductItemContentSelect(v) {

     document.getElementById("pitem").value = "";
     document.products.items2.value = v;
   
     ProductItemContent(v);

 } // end function
