/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/
function initScrollLayer() {
  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
  // if horizontal scrolling, id of element containing scrolling content (table?)
  var wndo = new dw_scrollObj('wn', 'lyr1', null);
  
  // pass id's of any wndo's that scroll inside tables
  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
  dw_scrollObj.GeckoTableBugFix('wn'); 
}

function email (login, sc)
{ var serv = new Array;
      serv[0] = "zgtec.com";
      eml = login + "@" + serv[sc];
return eml;
}
function writeemail (login, sc)
{
document.write (email(login, sc));
}
function sendemail (login, sc, sub)
{
eml = "mailto:" + email(login, sc);
if (sub != "") eml += "?subject=" + sub;
window.location.href = eml;
}





function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();

function sendajaxemail() {
	var msg = document.mainform.msg.value;
	var name = document.mainform.name.value;
	var address = document.mainform.address.value;
	var country = document.mainform.country.value;
	var phone = document.mainform.phone.value;
	var fax = document.mainform.fax.value;
	var email = document.mainform.email.value;				
	document.mainform.send.disabled=true; 
	document.mainform.send.value='Sending....';

    http.open('get', 'contact_ajax.php?msg='+msg+'&name='+name+'&email='+email+'&address='+address+'&country='+country+'&phone='+phone+'&fax='+fax+'&action=send');
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
			document.mainform.send.value='Send Message';
			document.mainform.send.disabled=false; 
        }
    }
}
