﻿var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
// Add by Shania 2009-04-13 Favicon
document.write("<link rel=icon href=http://www.moxa.com/images/favicon.ico type=image/x-icon>" );
document.write("<link rel=shortcut icon href=http://www.moxa.com/images/favicon.ico type=image/x-icon>");
// add end


document.write("\<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" );
document.write('<SCRIPT type="text/javascript" src="https://lct.salesforce.com/sfga.js"></SCRIPT>');

function open_print_window(purl){
 //var wx = window.open(purl, 'newwindow', 'height=1066, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
// wx.print();
window.print(); 
 return false;
}

function check_filename(tablename , starget , limit){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
        
        xhr.open("GET","/check_filename.aspx?tn=" + tablename + "&zn=" + starget +"&xn="+ limit ,false);

        xhr.send(null);
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
         if(ckstr.match("no")){
           
           return true;
         }
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
    return false;
}	

function check_filename2(tablename , starget , limit){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
        
        xhr.open("GET","/check_filename.aspx?tn=" + tablename + "&zn=" + starget +"&xn="+ limit ,false);

        xhr.send(null);
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
         if(ckstr.match("no")){
           
           return true;
         }
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
    return false;
}	


function set_prod(id){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
        
        xhr.open("GET","/set_prod.aspx?id=" + id  ,false);

        xhr.send(null);
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
         if(ckstr.match("no")){
           
           //return true;
         }
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
  //  return false;
}	


function get_quote_prod(){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
        
        xhr.open("GET","/get_prod.aspx"  ,false);

        xhr.send(null);
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
            return ckstr;
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
    return '';
}	


function get_logininfo(){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
       
        xhr.open("POST","/get_logininfo.aspx"  ,false);

        xhr.send('');
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
            return ckstr;
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
    return '';
}	
function get_logininfo2(){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
       
        xhr.open("POST","/get_logininfo.aspx"  ,false);
        xhr.setRequestHeader("Content-Length",0);
        xhr.send('');
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
            return ckstr;
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
    return '';
}	
function get_logininfo3(){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
       
        xhr.open("POST","/get_logininfo2.aspx"  ,false);
        xhr.setRequestHeader("Content-Length",0);
        xhr.send('');
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
            return ckstr;
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
    return '';
}

function get_logininfo4(){
     
     var xhr = '';
	 var tmp_link = '';
    if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) 
    {
        xhr = new XMLHttpRequest();
    }
   
    if (xhr)
    {
        
        
       
        xhr.open("POST","/get_logininfo3.aspx"  ,false);

        xhr.send('');
        if (xhr.readyState==4) {
        
         var ckstr = xhr.responseText;
            return ckstr;
         
        }
        
        
    }
    else{
        alert("XMLHTTPREQUEST IS FALSE");
    }
    return '';
}

function get_toplist(){
    var lists = '<div class="top_list"><ul><li><a href="http://www.moxa.com/about/contact_Moxa.htm" id="this_color_gb">Contact Moxa</a></li><li><a href="http://www.moxa.com/about/international_site.htm" id="this_color_bbk">International Sites</a></li><li><a href="http://esource.moxa.com" id="this_color_bbk">Partner Zone</a></li><li><a href="http://www.moxa.com/member/mymoxa.aspx" id="this_color_og">My Moxa</a></li></ul></div>';

    return lists;
}	

function get_footerlist(){
    var lists = '<div id="footernav">|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/product/product.aspx">Products</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/applications/application_home.aspx">Applications</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/support/support_home.aspx">Support</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/news_events/news_query.aspx">News &amp; Events</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/where_to_buy/where_to_buy.aspx">Where to Buy</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/about/Company_Profile.htm">About  Moxa</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/member/mymoxa.aspx">My Moxa</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.moxa.com/about/contact_Moxa.htm">Contact Moxa</a>   |   <a href="http://www.moxa.com/sitemap.htm">Sitemap</a>   |</div><div id="footer"><span class="copyright">© 2010 Moxa Inc. All rights reserved.</span><span class="menu"><img src="/images/icon3.gif" /><a href="http://www.moxa.com/about/privacy.htm"> Privacy</a><img src="/images/icon3.gif" alt="" /><a href="http://www.moxa.com/member/feedback.aspx">      Feedback</a></span></div>';
    
    
    return lists;


}

function set_main_icon(){
    var urlx = document.getElementById('icon_urlx');
    urlx.href = 'http://www.moxa.com/index.aspx';
}

	function google_search(){
	  
	  var ckq = document.getElementById('q');
	 
	 if(document.form1.as_q.value != 'search'){
	 ckq.value = document.form1.as_q.value ;
	 }
	
if (document.formx.Submit) {
     
    document.formx.Submit();
}
else {
   
    document.formx.submit();
}

	  
	}
	function txtbox_ck(){
	  if(document.form1.as_q.value == 'search' || document.form1.as_q.value == ''){
	     document.form1.as_q.value = 'search';
	     
	  } 
	}
	function txtbox_null(){
	 if(document.form1.as_q.value == 'search'){
	document.form1.as_q.value = '';
	}
	}
	
	function set_google_form(){
	    
	    
	  var aq = document.form1.as_q;
      
	    
if(window.addEventListener){ // Mozilla, Netscape, Firefox
	    
	    if(aq != null){
	     document.addEventListener("keypress", dispatch,false);
	     //alert('is set');
	    }   
}
else{ // IE
	    if(aq != null){
	   aq.attachEvent("onkeydown", google_enter);//IE use enter enable;
	     //aq.attachEvent("onkeydown", dispatch);// FireFox enetr enable
	    }
  }	    
	   // var aq = document.getElementById('as_q');
	   // if(aq != null){
	   //  aq.attachEvent("onkeydown", google_enter);
	   // }
		  var tmp = '<form action="http://www.moxa.com/search.htm" name="formx" id="formx" method="GET">';

	  tmp += '<input type="hidden" name="cx" value="017133840702386478730:qkjzhee2ijq" /><input type="hidden" name="cof" value="FORID:11" /><input type="hidden" name="q" id="q" size="25" /><input type="submit" name="submitz" style="display:none">   </form>';

	  tmp += '<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_017133840702386478730%3Aqkjzhee2ijq&lang=en"></script><INPUT type="hidden" name="sfga" value="00D200000001JNh" />';
	 
 var gform = document.getElementById('google_form');
	  gform.innerHTML = tmp;
var pageTracker = _gat._getTracker("UA-297123-1");
pageTracker._initData();
pageTracker._trackPageview();
 __sfga();  
	  
	}
	
	function set_google_link_analy(links){
	
var pageTracker = _gat._getTracker("UA-297123-1");
pageTracker._initData();
pageTracker._trackPageview("'" + links + "'");	
	
	}	
	
function google_enter(){
  
  if(event.keyCode == 13){
    google_search();
    return false;
  }
 // return false;
}


//============================================================
function Browser(){
 var d_ = document,n_ = navigator,t_ = this,s_= screen;
 
    var b = n_.appName;
    var ua = n_.userAgent.toLowerCase();
    
 t_.name = "Unknow";
 
 t_.safari = ua.indexOf("safari")>-1;  // always check for safari & opera
    t_.opera = ua.indexOf("opera")>-1;    // before ns or ie
 t_.firefox = !t_.safari && ua.indexOf('firefox')>-1; // check for gecko engine 
    t_.ns = !t_.firefox && !t_.opera && !t_.safari && (b=="Netscape");
    t_.ie = !t_.opera && (b=="Microsoft Internet Explorer");
 
 t_.name = (t_.ie ? "IE" : (t_.firefox ? "Firefox" : (t_.ns ? "Netscape" : (t_.opera ? "Opera" : (t_.safari ? "Safari" : "Unknow")))));
}

//=============================================================

 var dispatch = function (evt){
  evt = evt || event;
   var brw = new Browser();
               var   isie   =   (document.all)   ?   true   :   false;
                var   key;
                if   (isie)
                        key   =   window.event.keyCode;
                else
                        key   =   evt.which;   
    
    try{
     var xxname = document.activeElement.name;
    }catch(e){
      var xxname = "";
      
      if(document.form1.as_q.value != 'search' && document.form1.as_q.value != '')  xxname = "as_q";
    }
  
   if(key == 13 && xxname == 'as_q'){
   
   
    switch(brw.name){
     case "IE":
      evt.returnValue = false;
      evt.keyCode = 0;
      break;
     case "Firefox":
      //evt.returnValue = false;
      evt.preventDefault();
      
      break;
     case "Opera":
      evt.returnValue = false;
      evt.preventDefault();
      break;
     case "Safari":
      evt.preventDefault();
      evt.returnValue = false;
      }
      google_search();
      //for(o in evt)
      // document.write(o," ",typeof(eval("evt." + o))," = ",eval("evt." + o),"<br />");
      
    }
    
 
 
 }
	