var previous_tr="";
NN = (!document.all && document.getElementById);
var JavaTried = 0;
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
	(s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
		(s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
			(s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
				(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;


function body_load() {
}

function body_load_dna() {

  //LoadJavaApplet();
  
  if(document.getElementById("hld_dlm_enabled").value == "")
  {
    var control = null;
    try {
        control = new ActiveXObject('MANAGER.DLMCtrl.1');
        document.getElementById("hld_dlm_enabled").value = "1";
    }
     catch (e) {
        document.getElementById("hld_dlm_enabled").value = "0";
    }
    control = undefined;
  }

  //set the background color of table/td of selected file
  if(document.getElementById("hld_file_name").value !=""){
    //table background
    if(document.getElementById("td_"+document.getElementById("hld_file_name").value))
      document.getElementById("td_"+document.getElementById("hld_file_name").value).bgColor="#fffde2";
    //td background
    if(document.getElementById("tb_"+document.getElementById("hld_file_name").value))
      document.getElementById("tb_"+document.getElementById("hld_file_name").value).bgColor="#ffd477";
  }

  //check if the page is in iframe, if not, then redirect to the main page
  if(typeof parent.IsChild != "function")
    location.href = get_model_url();
    
  document.getElementById("select1").onchange = select1_change;
  parent.adjust_iframe_right_height(document.body.scrollHeight);  
  timerID = setInterval("hide_loading()",500);
  
/*  
  //Matching the hardware ID and version
  if(document.getElementById("hld_wizard").value == "1")
  {
    var IE = (navigator.userAgent.indexOf("MSIE") >= 0);
      
    if(IE)//ActiveX
    {
      if(LatestWizardInstalled())
      {
        CheckModelName();
        DoMatching();
      }
    }
    else
    {//none IE: Java Applet
      var objdiv = document.getElementById("objectDIV");
    
      if(!objdiv.innerHTML)
        LoadJavaApplet();
        
      if(getAppletObject())
      {
        CheckModelName();
        DoMatching();
      }
      else{
        alert("1234");
      }
    }
    
    //display the message of Navigation Wizard 
    if(document.getElementById("hld_object_loaded").value )
    {  
      document.getElementById("img_ok").innerHTML = document.getElementById("hld_recommended").value +" <IMG border='0' align='absMiddle' src='../images/HWID/icon-check-ok.gif'>";
      document.getElementById("chk_hid").innerHTML = "";
    }
    
  }    
  else
    document.getElementById("img_ok").innerHTML ="<a  class='download_menu' id='a_checkversion' href='javascript:show_hid_tb()'><IMG border='0' align='absMiddle' src='../images/icon-check.gif'>"+document.getElementById("hld_autodetect").value+"</a>"
*/    
}

function getAppletObject()
{
	if (Sys.firefox)
	{
		var embedTags = document.getElementsByTagName("embed");
		return embedTags["app"];
	}
	else if (Sys.ie || Sys.opera || Sys.safari || Sys.chrome)
	{
		var objectTags = document.getElementsByTagName("object");
		return objectTags["app"];
	}
}

function LoadJavaApplet()
{ 
  var sObjHTML =  "  <object id='app' width='0' height='0'                                                           "  +
                  "    classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93'                                          "  +
                  "    codebase='http://java.sun.com/update/1.6.0/jinstall-6u17-windows-i586.cab#Version=6,0,0,4'>   "  +
                  "	   <param name='name' value='ASUS System Information Control' />                                 "  +
                  "      <param name='code' value='com.asus.liveupdate.UpdateApplet.class' />                        "  +
                  "      <param name='archive' value='DriverUtils.jar' />                                            "  +
                  "      <param name='type' value='application/x-java-applet' />                                     "  +
                  "      <param name='scriptable' value='false' />                                                   "  +
                  "      <comment                                                                                    "  +
                  "		   <embed id='app' width='0' height='0'                                                        "  +
                  "			   name='ASUS System Information Control'                                                    "  +
                  "			   code='com.asus.liveupdate.UpdateApplet.class'                                             "  +
                  "			   archive='DriverUtils.jar'                                                                 "  +
                  "			   type='application/x-java-applet'                                                          "  +
                  "			   scriptable='false'                                                                        "  +
                  "			   pluginspage='http://java.sun.com/products/plugin/index.html#download'>                    "  +
                  "			   <noembed>                                                                                 "  +
                  "			   </noembed>                                                                                "  +
                  "		    </embed>                                                                                   "  +
                  "     </comment>                                                                                   "  +
                  "   </object>                                                                                      "  +
                  "                                                                                                  "  ;
  
  var objdiv = document.getElementById("objectDIV");
  
  if(!objdiv.innerHTML)
    objdiv.innerHTML = sObjHTML;
    
	var loaded = false; 
		  
  var app = getAppletObject();

	try {
    //var apptype = typeof app;
    if(Sys.opera && document.getElementById("hld_object_loaded").value !="1")
      alert("Java Applet for Opera is loaded");
	  //var hardwareid = app.getHadrwareId();
	  //setTimeout("DoNothing()", 2000);
	  
	  if(app != null)
		  loaded = true;
    document.getElementById("hld_object_loaded").value = "1";
	}
	catch(err){
	  alert(err);
	//  loaded = false;
	}
		  
	if (loaded){
		return true;
	}
	else
	{
	  if(JavaTried <=10)
	  {
	    JavaTried++;
	    setTimeout("LoadJavaApplet()", 1000); 	
	  }
	  else
	    return false;
  }
		
}

function DoNothing()
{
  var a = 1;
}

function CheckModelName()
{
  //stop matching if "hld_model_wizard" has data inside.
  if(document.getElementById("hld_model_wizard").value != "")
    return;
    
	//var IE = (navigator.appName.toLowerCase() == "microsoft internet explorer");
	var IE = (navigator.userAgent.indexOf("MSIE") >= 0);
	var Netscape = (navigator.appName.toLowerCase() == "netscape");
  var BIOS_SMBIOSBIOSVersion = "";
  var MB_Product = "";
  var result = "";
  try {
    if(IE){
      control = new ActiveXObject("AsusTek_sys_ctrl.asusTek_sysctrl.1");
      if(!control.MB_HardwareId)//if MB_HardwareId not found, be thrown to exception
      {
        parent.go_right("../common/nav_guide.aspx?SLanguage=" + document.getElementById("langNormal").value);
        return;
      }
      
      BIOS_SMBIOSBIOSVersion = control.BIOS_SMBIOSBIOSVersion;
      MB_Product = control.MB_Product;
      control = undefined; 
      
		  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  xmlhttp.open("GET", "../common/determine_model.aspx?nr=1&mode=0&BIOSVersion=" + BIOS_SMBIOSBIOSVersion + "&MBProduct=" + MB_Product + "&SLanguage=" + document.getElementById("langNormal").value, false);
		  xmlhttp.send();	
    }
    else
    {
      var app = getAppletObject();    
      BIOS_SMBIOSBIOSVersion = app.getSMBIOSVersion();
      MB_Product = app.getMBProduct();
      app = undefined;
//      alert(MB_Product);
		  xmlhttp = new XMLHttpRequest();
		  xmlhttp.open("GET", "../common/determine_model.aspx?nr=1&mode=0&BIOSVersion=" + BIOS_SMBIOSBIOSVersion + "&MBProduct=" + MB_Product + "&SLanguage=" + document.getElementById("langNormal").value, false);
		  xmlhttp.send(null);
    }
      	
	  result = xmlhttp.responseText;
	  document.getElementById("hld_model_wizard").value = result;
	  //alert(document.getElementById("msg_model").innerHTML);
	  if(result == "")
	  {
	    alert(document.getElementById("hld_message2").value);
	    parent.parent.document.location = "download.aspx?SLanguage=" + document.getElementById("langNormal").value;	 
	    return; 
	  }
    
	  
    if(document.getElementById("msg_model").innerHTML.toLowerCase() != result.toLowerCase())
    {
      if(confirm(document.getElementById("hld_message1").value))
	      parent.parent.document.location = "download.aspx?wizard=1&SLanguage=" + document.getElementById("langNormal").value + "&model=" + result;	 
    }  

  }
  catch (e) {
    control = undefined;
    parent.go_right("../common/nav_guide.aspx?SLanguage=" + document.getElementById("langNormal").value);
  }
}

function LatestWizardInstalled()
{
  try {
    control = new ActiveXObject("AsusTek_sys_ctrl.asusTek_sysctrl.1");
    if(!control.MB_HardwareId)
    {
        if(confirm(document.getElementById("hld_message4").value))
          parent.go_right("../common/nav_guide.aspx?SLanguage=" + document.getElementById("langNormal").value);

      control = undefined;
      document.getElementById("hld_object_loaded").value = "0"; 
      return false;
    }
    else
    {
      document.getElementById("hld_object_loaded").value = "1"; 
      control = undefined;
      return true;
    }
  }
  catch (e) {
    control = undefined;
    document.getElementById("hld_object_loaded").value = "0"; 
    return false;
  }
}

function DoMatching()
{
  var IE = (navigator.userAgent.indexOf("MSIE") >= 0);
  var control = null;
  var HIDs;
  try {
  
    if(IE){
      control = new ActiveXObject("AsusTek_sys_ctrl.asusTek_sysctrl.1");
      if(!control.MB_HardwareId)
      {
        //alert("Please install latest version!");
        if(confirm(document.getElementById("hld_message4").value))
          parent.go_right("../common/nav_guide.aspx?SLanguage=" + document.getElementById("langNormal").value);
          //show_hid_tb();
        return;
      }
      
      document.getElementById("hld_object_loaded").value = "1";  
      //HardIDs = "ACPI\ACPI0003=5.1.2535.0,ACPI\ATK0100=1043.2.15.51,ACPI\AuthenticAMD_-_x86_Family_15_Model_36=1.1.0.0,ACPI\FixedButton=5.1.2600.2180,ACPI\ITE8704=2.4.0.1,ACPI\PNP0000=5.1.2600.2180,ACPI\PNP0100=5.1.2600.2180,ACPI\PNP0200=5.1.2600.2180,ACPI\PNP0303=5.1.2600.2180,ACPI\PNP0401=5.1.2600.0,ACPI\PNP0510=5.1.2535.0,ACPI\PNP0800=5.1.2600.2180,ACPI\PNP0A03=5.1.2600.2180,ACPI\PNP0A06=5.1.2600.2180,ACPI\PNP0B00=5.1.2600.2180,ACPI\PNP0C01=5.1.2600.2180,ACPI\PNP0C02=5.1.2600.2180,ACPI\PNP0C02=5.1.2600.2180,ACPI\PNP0C02=5.1.2600.2180,ACPI\PNP0C02=5.1.2600.2180,ACPI\PNP0C04=5.1.2600.2180,ACPI\PNP0C09=5.1.2535.0,ACPI\PNP0C0A=5.1.2535.0,ACPI\PNP0C0B=5.1.2600.2180,ACPI\PNP0C0D=5.1.2600.2180,ACPI\PNP0C0E=5.1.2600.2180,Dcxax-8101=5.1.2600.2180,ACPI\SYN0A01=8.1.5.0,ACPI\ThermalZone=5.1.2600.2180,ACPI_HAL\PNP0C08=5.1.2535.0,Bluetooth\0004&0002=2.1.1127.0,Bluetooth\0004&0002=2.1.1126.0,Bluetooth\0004&0002=2.1.1127.0,Bluetooth\0004&0002=2.1.1127.0,Bluetooth\0004&0002=2.1.1127.0,Bluetooth\0004&0002=2.1.1127.0,Bluetooth\0004&0002=2.1.1127.0,Bluetooth\0004&0002=2.1.1127.0,Bluetooth\0004&0002=2.1.1127.0,Monitor\Default_Monitor=5.1.2001.0,Monitor\Default_Monitor=5.1.2001.0,Monitor\LPL0000=5.1.2001.0,HDAUDIO\FUNC_01&VEN_10EC&DEV_0880&SUBSYS_1043120D&REV_1008=5.10.0.5136,HID\Vid_046d&Pid_c016&Rev_0340=5.1.2600.0,IDE\CdRomMATSHITA_DVD-RAM_UJ-841S________________1.00____=5.1.2535.0,IDE\DiskFUJITSU_MHV2100AH_______________________00000096=5.1.2535.0,ISAPNP\ReadDataPort=5.1.2600.2180,LPTENUM\MicrosoftRawPort958A=5.1.2600.2180,PCI\VEN_1002&DEV_4371&SUBSYS_00000000&REV_80=5.1.2600.2180,PCI\VEN_1002&DEV_4372&SUBSYS_11D71043&REV_81=5.10.1000.5,PCI\VEN_1002&DEV_4373&SUBSYS_43731002&REV_80=5.1.2600.0,PCI\VEN_1002&DEV_4374&SUBSYS_43741002&REV_80=5.1.2600.2180,PCI\VEN_1002&DEV_4375&SUBSYS_43751002&REV_80=5.1.2600.2180,PCI\VEN_1002&DEV_4376&SUBSYS_43761002&REV_80=5.1.2600.2180,PCI\VEN_1002&DEV_4377&SUBSYS_00000000&REV_80=5.1.2600.2180,PCI\VEN_1002&DEV_437B&SUBSYS_11231043&REV_01=5.10.0.5010,PCI\VEN_1002&DEV_5653&SUBSYS_11221043&REV_00=6.14.10.6553,PCI\VEN_1002&DEV_5950&SUBSYS_00000000&REV_10=5.1.2600.2180,PCI\VEN_1002&DEV_5A34&SUBSYS_00000000&REV_00=5.1.2600.2180,PCI\VEN_1002&DEV_5A38&SUBSYS_00000000&REV_00=5.1.2600.2180,PCI\VEN_1022&DEV_1100&SUBSYS_00000000&REV_00=5.1.2600.2180,PCI\VEN_1022&DEV_1101&SUBSYS_00000000&REV_00=5.1.2600.2180,PCI\VEN_1022&DEV_1102&SUBSYS_00000000&REV_00=5.1.2600.2180,PCI\VEN_1022&DEV_1103&SUBSYS_00000000&REV_00=5.1.2600.2180,PCI\VEN_1180&DEV_0476&SUBSYS_11D71043&REV_B3=5.1.2600.0,PCI\VEN_1180&DEV_0552&SUBSYS_11D71043&REV_08=5.1.2535.0,PCI\VEN_1180&DEV_0592&SUBSYS_11D71043&REV_08=1.0.1.5,PCI\VEN_1180&DEV_0822&SUBSYS_11D71043&REV_17=1.0.3.3,PCI\VEN_1180&DEV_0852&SUBSYS_11D71043&REV_03=1.0.1.5,PCI\VEN_11AB&DEV_4362&SUBSYS_11D51043&REV_19=8.32.2.3,PCI\VEN_14E4&DEV_4318&SUBSYS_120F1043&REV_02=3.100.64.0,PCI\VEN_4444&DEV_0016&SUBSYS_C1361461&REV_01=1.0.1.32,1002-4376=5.1.2600.2180,1002-4376=5.1.2600.2180,acpiapic_up=5.1.2600.0,root\Bluetooth_com=2.1.1127.0,Cntx_VPCNetS2_MP=2.6.553.0,Cntx_VPCNetS2_MP=2.6.553.0,COMPOSITE_BATTERY=5.1.2535.0,*FSVGA932=5.1.2535.0,ROOT\DMIO=5.1.2600.2180,ROOT\FTDISK=5.1.2600.2180,MS_MMACM=5.1.2535.0,MS_MMDRV=5.1.2535.0,MS_MMMCI=5.1.2535.0,MS_MMVCD=5.1.2535.0,MS_MMVID=5.1.2535.0,MS_IrdaMiniport=5.1.2535.0,ms_l2tpminiport=5.1.2535.0,ms_ndiswanip=5.1.2535.0,ms_pppoeminiport=5.1.2535.0,ms_pptpminiport=5.1.2535.0,ms_ptiminiport=5.1.2535.0,ROOT\RDPDR=5.1.2600.2180,ROOT\RDP_KBD=5.1.2600.2180,ROOT\RDP_MOU=5.1.2600.2180,Rockey\R5Smc=2.5.4.408,Rockey\R5Smc=2.5.4.408,root\swenum=5.1.2600.2180,root\update=5.1.2600.2180,root\mssmbios=5.1.2600.2180,*VMnetAdapter1=4.0.1.0,*VMnetAdapter8=4.0.1.0,SCSI\CdRomOHU_____6NWDMF4_________3.5Z=5.1.2535.0,STORAGE\Volume=5.1.2600.0,STORAGE\Volume=5.1.2600.0,STORAGE\Volume=5.1.2600.0,STORAGE\Volume=5.1.2600.0,STORAGE\Volume=5.1.2600.0,STORAGE\Volume=5.1.2600.0,SW\{a7c7a5b0-5af3-11d1-9ced-00a024bf0407}=5.1.2535.0,SW\{b7eafdc0-a680-11d0-96d8-00aa0051e51d}=5.1.2535.0,SW\{cd171de3-69e5-11d2-b56d-0000f8754380}=5.1.2535.0,USB\ROOT_HUB&VID1002&PID4374&REV0080=5.1.2600.2180,USB\ROOT_HUB&VID1002&PID4375&REV0080=5.1.2600.2180,USB\ROOT_HUB20&VID1002&PID4373&REV0080=5.1.2600.2180,USB\Vid_0402&Pid_5602&Rev_0100=2.6.0.20,USB\Vid_046d&Pid_c016&Rev_0340=5.1.2600.2180,USB\Vid_058f&Pid_6362&Rev_0126=5.1.2600.0,USBSTOR\DiskGeneric_USB_CF_Reader___1.01=5.1.2535.0,USBSTOR\DiskGeneric_USB_MS_Reader___1.03=5.1.2535.0,USBSTOR\DiskGeneric_USB_SD_Reader___1.00=5.1.2535.0,USBSTOR\DiskGeneric_USB_SM_Reader___1.02=5.1.2535.0,V1394\NIC1394=5.1.2535.0"; 
      HardIDs = "HDAUDIO_FUNC_01&VEN_10EC&DEV_0880=5.10.0.5136,BLUETOOTH_0004&0002=1.1.1127.0";
      HIDs = HardIDs.split(',');
      //HIDs = control.MB_HardwareId.split(',');
    }
    else{
      var app = getAppletObject();    
      //HardIDs = app.getHadrwareId();
      HardIDs = "HDAUDIO_FUNC_01&VEN_10EC&DEV_0880=5.10.0.5136,BLUETOOTH_0004&0002=1.1.1127.0";
      HIDs = HardIDs.split(',');
      app = undefined;
    
    } 
    
    var HID_num = 0;        
    while (HID_num < HIDs.length)
    {
      hid = HIDs[HID_num].split('=')[0].replace(/\\/g, "_");
      ver = HIDs[HID_num].split('=')[1];
    //  alert(hid+"-------"+ver);    
    //document.getElementsByName("img_"+hid)[0].src = "../images/icon-check-ok.gif";
    //document.getElementsByName("img_"+hid)[1].src = "../images/icon-check-ok.gif";
  
//      alert(document.getElementsByName(hid).length);
//      if(document.getElementsByName("hld_"+hid))
      if(document.getElementsByName(hid))
      {
        
        var h = 0;
//        alert(document.getElementsByTagName("INPUT").length);
//        alert(document.getElementById("hld_"+hid).value);//.getElementsByTagName("input").length);
        var fTags;
        
//        if(IE)
//          fTags = document.getElementsByName("hld_"+hid);
//        else
//          fTags = getElementsByName_none_IE("INPUT", hid);
        fTags = document.getElementsByName(hid);  
        
//        alert("INPUT tag: "+fTags.length);
          
//        while(h < document.getElementsByName("hld_"+hid).length)
        while(h < fTags.length)
        {
        //alert(ver+" vs. "+document.getElementById("hld_"+hid).getElementsByTagName("input").length);
//          show = ShowCheckIcon(ver, document.getElementsByName("hld_"+hid)[h].value);
          show = ShowCheckIcon(ver, fTags[h].value);
//          alert(show);
          if(show)
          {
            document.getElementsByName("img_"+hid)[h].src = "../images/icon-check-ok.gif";
            break;            
          }
           h++;
        }
        //document.getElementsByName("hld_"+hid).length
        //alert(hid + "="+ ver + ", found matched HID");
        //if(document.getElementById("CheckBox1").checked)
        
      }     
      
      HID_num+=1;
      //return;
    }
  }
  catch (e) {
    //alert("Active X Not installed");
    if(confirm(document.getElementById("hld_message4").value))
    {
      control = undefined;
      //show_hid_tb();
      parent.go_right("../common/nav_guide.aspx?SLanguage=" + document.getElementById("langNormal").value);
      
      return;
    }
  }
  control = undefined;
}

function getElementsByName_none_IE(tag, name) {
  var elem = document.getElementsByTagName(tag);
  var arr = new Array();
  for(i = 0,iarr = 0; i < elem.length; i++) {
    att = elem[i].getAttribute("name");
    if(att == name) {
      arr[iarr] = elem[i];
      iarr++;
    }
  }
  //alert(arr.length);
  return arr;
} 

function ShowCheckIcon()//check version between the machine and page
{
  var VerM = arguments[0].split('.'); //version of machine
  var VerF = arguments[1].split('.'); //version of file 
  var show = false;
  //alert(VerM.length+" + "+VerF.length);
  //alert(VerM[3]+" + "+VerF[3]);
  
  //if the format is not 'xx.xx.xx.xx', then no show;
  if(VerM.length != 4 || VerF.length != 4) 
    return false;
    
  try{
    for(i = 0; i <4; i++)
    {
      //alert(VerM[i]+" + "+VerF[i]);
      if(VerM[i] < VerF[i])
        show = true;    
    }  
  }
  catch(e)
  {
    show = false
  }

  return show;
}

function LoadActiveX()
{ 
  var sObjHTML = "<object id='asusTek_sysctrl' classid='CLSID:0D41B8C5-2599-4893-8183-00195EC8D5F9' codebase='../common/asusTek_sys_ctrl3.cab#version=3,0,0,1' width=0 height=0 VIEWASTEXT>";
  var objdiv = document.getElementById("objectDIV");
  if(!objdiv.innerHTML)
    objdiv.innerHTML = sObjHTML;
//  alert(objdiv.innerHTML);
  
	var loaded = false;
		  
	try {
	  if (document.getElementById("asusTek_sysctrl").MB_HardwareId)
		  loaded = true;
	}
	catch(err){}
		  
	if (loaded){
		alert("Loaded");
	}
	else
		setTimeout("LoadActiveX()",1000); 	
  //alert(asusTek_sysctrl.MB_HardwareId);
}

function show_hid_tb()
{ 
	if (document.getElementById("ddlOS").value != "-1")
		os = document.getElementById("ddlOS").value;
  else
    os = "";    
//    alert(os);
//  parent.parent.parent_show_hid_tb(document.getElementById("langNormal").value, document.getElementById("msg_model").innerHTML, os);
  parent.parent.parent_show_hid_tb(document.getElementById("langNormal").value, document.getElementById("msg_model").innerHTML);
}

function is_DLM_supported()
{
	var isWindows = (navigator.userAgent.indexOf("Windows") >= 0);
	var isLinux   = (navigator.userAgent.indexOf("Linux") >= 0);
	var isMacFF   = (navigator.userAgent.indexOf("Firefox") >= 0 && navigator.userAgent.indexOf("Mac") >= 0);
	var isSafari  = (navigator.userAgent.indexOf("Safari") >= 0);
	var isSolaris = (navigator.userAgent.indexOf("Sun") >= 0);
	var isWinFF   = (navigator.userAgent.indexOf("Firefox") >= 0 && navigator.userAgent.indexOf("Windows") >= 0);
	var isIE4     = (navigator.userAgent.indexOf("MSIE 4") >= 0);
	var isIE5     = (navigator.userAgent.indexOf("MSIE 5") >= 0);
	var isIE6     = (navigator.userAgent.indexOf("MSIE 6") >= 0  && navigator.userAgent.indexOf("MSIE 7") < 0);
	var isIE7     = (navigator.userAgent.indexOf("MSIE 7") >= 0);
	var isIE8     = (navigator.userAgent.indexOf("MSIE 8") >= 0);	
	var isIE      = (navigator.userAgent.indexOf("MSIE") >= 0);	
	var isOpera   = ((navigator.userAgent.indexOf("Opera") >= 0) || (navigator.userAgent.indexOf("Gecko/20061208") >= 0));
	var DLM_supported = false;
	if(navigator.userAgent.indexOf("Windows") >= 0)
	{ 	
	  if(isIE7 || isIE8 || isWinFF)
			DLM_supported = true;
		else
			DLM_supported = false;  
	}
	else
		DLM_supported = false;
		
	return DLM_supported;
}

function is_DLM_enabled()
{
  DLM_enabled = false;
  if(document.getElementById("hld_dlm_enabled").value != "1")
  {
    try {
        control = new ActiveXObject('MANAGER.DLMCtrl.1');  //DLM enabled if Object can be created
        document.getElementById("hld_dlm_enabled").value = "1";
        control = undefined;
    }
     catch (e) {
        document.getElementById("hld_dlm_enabled").value = "0";
    }
  }
 
  if(document.getElementById("hld_dlm_enabled").value == "1")
    return true;
  else
    return false;
}


function is_DNA_enabled()
{
  DNA_enabled = false;
  if(document.getElementById("hld_dna_enabled").value == "")
  {
    port = btdna_port("http://support.asus.com");
    //if port is a "number"，即表示已安裝DNA
    if(IsNumeric(port))
      document.getElementById("hld_dna_enabled").value = "1";
    else
      document.getElementById("hld_dna_enabled").value = "0";
  }
 
  if(document.getElementById("hld_dna_enabled").value == "1")
    return true;
  else
    return false;
}

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;   
}

function show_dna_tb()
{ 
  parent.parent.parent_show_dna_tb(arguments[0], arguments[1]);
}

function show_dlm()
{ 
  	wx = 860;
	wy = 520;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	url = "download_item_dlm.aspx?file="+arguments[0]+"&SLanguage="+arguments[1];
	subwin = window.open(url,"newChatWindow","width=860,height=520,status=no, toolbar=no, location=no,menubar=no, left="+x+",top="+y);
}


function show_os_tb()
{ 
	if(arguments.length > 4)
		parent.parent.parent_show_tb(arguments[0], arguments[1], arguments[2], arguments[3]);
	else
		parent.parent.parent_show_tb(arguments[0], arguments[1], arguments[2]);
//wizard
//	if(arguments.length > 4)
//		parent.parent.parent_show_tb(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
//	else
//		parent.parent.parent_show_tb(arguments[0], arguments[1], arguments[2], arguments[3]);
}

function select1_change(){
  if (document.getElementById("select1").value == "0"){
    document.getElementById("select2").innerHTML = "";
    document.getElementById("select2").add(new Option(document.getElementById("hld_select2_welcome").value,"0"));
    return;
  }
 
  parent.show_loading();
  setTimeout("get_select2()",500);
}

function get_select2() {
  IE       = (navigator.appName.toLowerCase() == "microsoft internet explorer");
  Netscape = (navigator.appName.toLowerCase() == "netscape");

	if(IE){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open("GET","../common/3combo_databind.aspx?workMode=0&select1_id=" + document.getElementById("hldProduct").value + "&select2_id=" + document.getElementById("select1").value + "&SLanguage=" + document.getElementById("langNormal").value,false);
		xmlhttp.send();
	  
		xmldoc = new ActiveXObject("Microsoft.XMLDOM");
		xmldoc.loadXML(xmlhttp.responseText);
	  
		document.getElementById("select2").innerHTML = "";
		document.getElementById("select2").add(new Option(document.getElementById("hld_select2_welcome").value,"0"));
	  
		nodes = xmldoc.selectNodes("/NewDataSet/Table");
		for(i=0; i<nodes.length; i++)
			document.getElementById("select2").add(new Option(nodes[i].childNodes(0).text, nodes[i].childNodes(1).text));
	}
	else{
		xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET", "../common/3combo_databind.aspx?workMode=0&select1_id=" + document.getElementById("hldProduct").value + "&select2_id=" + document.getElementById("select1").value + "&SLanguage=" + document.getElementById("langNormal").value,false);
		xmlhttp.send(null);
		res = xmlhttp.responseText;  
    try{
      parser = new DOMParser();
      xmldoc = parser.parseFromString(res,"text/xml");
      if(Netscape){
				var select = null;
				select = document.getElementById("select2");
				while (select.length > 0) {
					select.remove(0);
				}
				var opt1 = null;
				opt1 = document.createElement("option");
				opt1.textContent = document.getElementById("hld_select2_welcome").value;
				opt1.value = "0";
				document.getElementById("select2").appendChild(opt1);     

	      
				nodes_l2 = xmldoc.getElementsByTagName("ml_name");
				nodes_wa = xmldoc.getElementsByTagName("m_name");
	      	    
				for(i=0; i<nodes_l2.length; i++){
					var opt = document.createElement("option");
					opt.textContent = nodes_l2[i].childNodes[0].nodeValue;
					opt.value = nodes_wa[i].childNodes[0].nodeValue;
					document.getElementById("select2").appendChild(opt);
				}
      }
      else
      {//opera
				document.getElementById("select2").innerHTML = "";
				document.getElementById("select2").add(new Option(document.getElementById("hld_select2_welcome").value,"-1"));
					
				
				nodes = xmldoc.selectNodes("/NewDataSet/Table");
				for(i=0; i<nodes.length; i++){
					document.getElementById("select2").add(new Option(nodes[i].selectNodes("ml_name")[0].text, nodes[i].selectNodes("m_name")[0].text));	    
				}
      }
    }
    catch(e)
    {
	  alert(e.message);
    }
	}

	document.getElementById("select2").disabled = false;
  
  parent.hide_loading();
}

function ShowFrame() {
	display = (document.getElementById(arguments[0]).style.display.toLowerCase() == "inline")
	if(display)
	{
		document.getElementById(arguments[0]).style.display = "none";
		document.getElementById(arguments[1]).style.display = "inline";
		document.getElementById(arguments[2]).style.display = "none";
	}
	else
	{
		document.getElementById(arguments[0]).style.width   = "100%";
		document.getElementById(arguments[0]).style.display = "inline";
		document.getElementById(arguments[1]).style.display = "none";
		document.getElementById(arguments[2]).style.display = "inline";
	}
  parent.adjust_iframe_right_height(document.body.scrollHeight);  
}

function gethtml() {
  try {
    r_text = document.getElementById("ifr_download").Document.documentElement.innerHTML;
  }
  catch(e) {
    r_text = "null";
  }     
  
  if (r_text.indexOf("404") > 0 || r_text == "null") {
    alert(document.getElementById("hldTooManyUser").value);
    r_text = "";
    document.getElementById("ifr_download").src = "blank.htm";
  }
}

function chk_url_exist() {
  if (document.getElementById("ifr_download").readyState == "complete")
    gethtml();
  else
    setTimeout("chk_url_exist()",1000);
}

function get_model_url() {
	if (document.getElementById("ddlOS").value != "-1")
		os = "&os="+document.getElementById("ddlOS").value;
	else
		os = "";

  var s = location.href;
  var i = s.indexOf("download_item_dna.aspx");//hldProduct
  s = s.substring(0,i);
  return s + "download.aspx?model=" + escape(document.getElementById("hldModel").value) + os + "&SLanguage=" + document.getElementById("langNormal").value + "&product=" +document.getElementById("hldProduct").value;
}

function AddFavorite() {
  IE = (document.all && navigator.userAgent.indexOf("Opera") == -1);
  
  if (IE) {
    document.getElementById("copyArea").value = get_model_url();
    r = document.getElementById("copyArea").createTextRange();
    r.select();
    r.execCommand("copy"); 
    parent.window.scrollTo(0,0);
    alert(document.getElementById("hld_shortcut_ok").value);
  }
}

function AddShortcut() {
  IE = (document.all && navigator.userAgent.indexOf("Opera") == -1);
  
  if (IE)
    window.external.AddFavorite(get_model_url(),"ASUS Support--Download(" + document.getElementById("msg_model").innerHTML + ")");
}

function imgOK_Click() {
  var model   = document.getElementById("select2").value;
  var product = document.getElementById("hldProduct").value;    
  var langID  = document.getElementById("langNormal").value
  
  if (model == "0") {
    return;
  }
  
  alert(model);
    
  document.getElementById("msg_model").innerText  = model;
  document.getElementById("msg_model2").innerText = model;
  
  var url = "download_item_dna.aspx?product=" + product + 
                              "&model=" + model + 
                              "&SLanguage=" + langID;
  
  location.href = url;                              
}

function All_Click()
{
 parent.document.getElementById("ifr_user_right").src = "download_item_dna.aspx?product="+document.getElementById("hldProduct").value+"&model="+document.getElementById("msg_model").innerHTML+"&type=All&Slanguage="+document.getElementById("langNormal").value; 
}

function Map_Click()
{
 parent.document.getElementById("ifr_user_right").src = "download_item_dna.aspx?product="+document.getElementById("hldProduct").value+"&model="+document.getElementById("msg_model").innerHTML+"&type=Map&Slanguage="+document.getElementById("langNormal").value; 
}

function a_close_click() {
  document.all("tbl_bios_history").style.display = "none";
	document.getElementById("mask_bios_history").style.display = "none";
}
function a_close2_click() {
  document.all("tbl_bios_warnning").style.display = "none";
}

//function show_bios_warnning(){
//  parent.parent.show_bios_warnning();
//}

function show_bios_warnning(){

  document.getElementById("tbl_bios_warnning").style.display = "inline";
  document.getElementById("tbl_bios_warnning").offsetHeight;
  
  IE = (navigator.appName.toLowerCase() == "microsoft internet explorer");
  if(IE)
  {
    document.getElementById("tbl_bios_warnning").style.pixelTop  = document.body.scrollTop;
    document.getElementById("tbl_bios_warnning").style.pixelLeft = (document.body.clientWidth/2)-(document.getElementById("tbl_bios_warnning").offsetWidth/2)+(document.body.scrollLeft+10); 
  }
  else 
  {
    document.getElementById("tbl_bios_warnning").style.top  = String(document.body.scrollTop) +"px";
    document.getElementById("tbl_bios_warnning").style.left = String((document.body.clientWidth/2)-(document.getElementById("tbl_bios_warnning").offsetWidth/2)+(document.body.scrollLeft+10))  +"px";; 
  } 
   
  if(arguments.length > 0)
  {
    if(arguments[0] == "3" || arguments[0] == "21")
      document.getElementById("lbl_bios_warnning").innerHTML = document.getElementById("hld_bios_warning").value.replace(/\\n/g, "<br>");
    else if(arguments[0] == "37")
      document.getElementById("lbl_bios_warnning").innerHTML = document.getElementById("hld_efibios_warning").value.replace(/\\n/g, "<br>");
  }
  else
  {
    document.getElementById("lbl_bios_warnning").innerHTML = document.getElementById("hld_bios_warning").value.replace(/\\n/g, "<br>");  
  }
}

function a_close2_click() {
  document.all("tbl_bios_warnning").style.display = "none";
}

function a_bios_history_click()
{
	tbl_bios_history_show = (document.getElementById("tbl_bios_history").style.display.toLowerCase() == "inline");
	if(!tbl_bios_history_show){
		document.getElementById("tbl_bios_history").style.display = "inline";
		document.getElementById("tbl_bios_history").style.top = (screen.height/2)-370; 
		document.getElementById("tbl_bios_history").style.left = (screen.width/2)-335; 
		document.getElementById("mask_bios_history").style.display = "inline";
		document.getElementById("mask_bios_history").style.top = (screen.height/2)-370+10; 
		document.getElementById("mask_bios_history").style.left = (screen.width/2)-335+10; 
	}
	else
	{
		document.getElementById("tbl_bios_history").style.display = "none";
		document.getElementById("mask_bios_history").style.display = "none";
	}
}

function CopyLink() {
  IE = (document.all && navigator.userAgent.indexOf("Opera") == -1);
  if (IE) {
    r = document.getElementById(arguments[0]).createTextRange();
    r.select();
    r.execCommand("copy"); 
    alert(document.getElementById("hld_shortcut_ok").value);
  }
}

function dlcount() {
	IE       = (navigator.appName.toLowerCase() == "microsoft internet explorer");
	Netscape = (navigator.appName.toLowerCase() == "netscape");
    strXML = "<?xml version='1.0'?>" + 
              "<root>" + 
                "<l1_id>" + arguments[1] + "</l1_id>" + 
                "<l2_id>" + arguments[2] + "</l2_id>" + 
                "<l3_id>" + arguments[3] + "</l3_id>" + 
                "<m_id>" + arguments[4] + "</m_id>" + 
//                "<f_name>" + unescape(arguments[5]) + "</f_name>" + 
                "<f_name>" + unescape(arguments[5]).replace(/&/, "&amp;") + "</f_name>" + 
                "<dl_from>" + arguments[6] + "</dl_from>" + 
              "</root>";
  if (IE) {//for IE
    xmldoc = new ActiveXObject("Microsoft.XMLDOM");
    
    xmldoc.async = false;
    
              
    xmldoc.loadXML(strXML);
  
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open("POST","download_item_dlcount.aspx",true);
    xmlhttp.send(xmldoc);
    
    ext = JustExt(arguments[5]);
    ext = ext.toLowerCase();
    
    if (ext == "pdf") {
      arguments[0].target = "_blank";
    }
    else {
      arguments[0].target = "ifr_download";
      setTimeout("chk_url_exist()",1000);
    }
  }
  else {// non IE: like Firefox, Opera 8.0+, Safari ...
	  var xmlhttp=null;
	  try
	  {
	    xmlhttp = new XMLHttpRequest();
	  }
	  catch (e)
	  {
	    try// Internet Explorer
 	    {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	    }
	    catch (e)
	    {
		  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
    
    xmlhttp.open("POST", "download_item_dlcount.aspx", false);
    xmlhttp.setRequestHeader("Content-Type", "text/xml");
    xmlhttp.send(strXML);    
  
    ext = JustExt(arguments[5]);
    ext = ext.toLowerCase();
  
    if (ext == "pdf")
      arguments[0].target = "_blank";
  }
}

function MemberLogin() {
	wx = 650;
	wy = 260;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	url = 'http://vip.asus.com/forum/login.aspx?Slanguage='+document.getElementById("langNormal").value+'&f_type='+arguments[5]+'&product='+arguments[0]+'&model='+document.getElementById("hldModel").value+'&f_name='+escape(arguments[4]);
	subwin = window.open(url,"sub","toolbar=no, location=no, scrollbars=yes, left="+x+",top="+y+",width="+wx+",height="+wy);
}

function cn_click()
{
  var vNum = Math.round(Math.random()*65535);
  var f_name = arguments[7];
  //Hide previous TR
  if(document.getElementById(previous_tr))
    document.getElementById(previous_tr).style.display = "none";
    
  if(document.getElementById("hld_checked").value == "1")
  {
    downloadfile_cn(this, escape(arguments[1]), escape(arguments[2]), arguments[3], arguments[4], arguments[5], arguments[6], escape(arguments[7]), arguments[8], arguments[9]);
  }
  else
  {
    //Generate Code to document.getElementById("hld_ImgCode")
    GenCode();
    
    //Show current TR & DIV
    document.getElementById("tr_"+f_name).style.display = "inline";  
    document.getElementById("div_"+f_name).innerHTML = 
    "  <table width='100%' border='0' cellspacing='0' cellpadding='0'>"+
    "      <tr>"+
    "        <td width='200'><img src='Img.aspx?code="+encMe(document.getElementById("hld_ImgCode").value, "dot5.gif")+"' width='200' height='60' /></td>"+
    "        <td width='10'><table width='1' border='0' cellspacing='0' cellpadding='0'>"+
    "            <tr>"+
    "              <td width='1' height='80' background='../images/asus_download_dot5.gif'></td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "        <td width='425' style='padding-left:10px'>"+
    "            <strong><span id='pls_"+f_name+"' class='download_show'></span></strong><br>"+
    "            <span id='msg_"+f_name+"' class='download_show' style='color:#990000'></span>"+
    "          <table border='0' cellpadding='0' cellspacing='0' style='border-bottom-color:#191919'>"+
    "            <tr>"+
    "              <td align='left'><input type='text' name='textfield7' id='txt_"+f_name+"' style='width:100px' /></td>"+
    "              <td align='left' class='download_show' style='padding-left:20px; color:#990000'><table border='0' align='center' cellpadding='0' cellspacing='0'>"+
    "                  <tr>"+
    "                    <td><div id='button02'><a id='current' onmouseover=\"javascript:window.status='';return true\" href=javascript:downloadfile_cn(this,'"+escape(arguments[1]) + "','" +
                                                          escape(arguments[2]) + "','" +
                                                          arguments[3] + "','" +
                                                          arguments[4] + "','" +
                                                          arguments[5] + "','" +
                                                          arguments[6] + "','" +
                                                          escape(arguments[7]) + "','" +
                                                          arguments[8] + "','" +
                                                          arguments[9] + "')>" +
    "                        <span id='btn_"+f_name+"'>Download</span></a></div>" +
    "                    </td>" +
    "                  </tr>"+
    "                </table>"+
    "              </td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "      </tr>"+
    "    </table>";
    document.getElementById("pls_"+f_name).innerHTML = document.getElementById('hld_pls_message').value;
    document.getElementById("btn_"+f_name).innerHTML = document.getElementById('hld_confirm').value;
    document.getElementById("txt_"+f_name).onkeydown = txt_keyword_KeyDown;
    document.getElementById("txt_"+f_name).focus();
  }
  //Store current TR name
  previous_tr = "tr_"+f_name;
  parent.adjust_iframe_right_height(document.body.scrollHeight);  
}

function downloadfile_cn() {
  f_name = unescape(arguments[7]);

  if(!check(f_name)){
    document.getElementById("msg_"+f_name).innerHTML = document.getElementById('hld_err_message').value;
    return;
  }
  else{
    if(document.getElementById("msg_"+f_name))
      document.getElementById("msg_"+f_name).innerHTML = ""; 
  }

  url      = "http://dlsvr04.asus.com/pub/ASUS/" + escape(arguments[2]);
	IE       = (navigator.appName.toLowerCase() == "microsoft internet explorer");
	Netscape = (navigator.appName.toLowerCase() == "netscape");
  ext = JustExt(arguments[2]);
  ext = ext.toLowerCase();
  if (ext == "pdf") {
        arguments[0].target = "_blank";
		    subwin = window.open(url,"","");
  }
  else {
	  document.getElementById("ifr_download").src = url;
	  if(IE)
			  setTimeout("chk_url_exist()",1000);
  }      
  dlcount(arguments[0], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], 2); 
}

function global_click()
{
  var vNum = Math.round(Math.random()*65535);
  var f_name = arguments[7];

  //Hide previous TR
  if(document.getElementById(previous_tr))
    document.getElementById(previous_tr).style.display = "none";

  if(document.getElementById("hld_checked").value == "1")
  {
    downloadfile(this, escape(arguments[1]), escape(arguments[2]), arguments[3], arguments[4], arguments[5], arguments[6], escape(arguments[7]), arguments[8], arguments[9]);
  }
  else
  {
    //Generate Code to document.getElementById("hld_ImgCode")
    GenCode();
    //Show current TR & DIV
    document.getElementById("tr_"+f_name).style.display = "inline";  
    document.getElementById("div_"+f_name).innerHTML = 
    "  <table width='100%' border='0' cellspacing='0' cellpadding='0'>"+
    "      <tr>"+
    "        <td width='200'><img src='Img.aspx?code="+encMe(document.getElementById("hld_ImgCode").value, "dot5.gif")+"' width='200' height='60' /></td>"+
    "        <td width='10'><table width='1' border='0' cellspacing='0' cellpadding='0'>"+
    "            <tr>"+
    "              <td width='1' height='80' background='../images/asus_download_dot5.gif'></td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "        <td width='425' style='padding-left:10px'>"+
    "            <strong><span id='pls_"+f_name+"' class='download_show'></span></strong><br>"+
    "            <span id='msg_"+f_name+"' class='download_show' style='color:#990000'></span>"+
    "          <table border='0' cellpadding='0' cellspacing='0' style='border-bottom-color:#191919'>"+
    "            <tr>"+
    "              <td align='left'><input type='text' name='textfield7' id='txt_"+f_name+"' style='width:100px' /></td>"+
    "              <td align='left' class='download_show' style='padding-left:20px; color:#990000'><table border='0' align='center' cellpadding='0' cellspacing='0'>"+
    "                  <tr>"+
    "                    <td><div id='button02'><a id='current' onmouseover=\"javascript:window.status='';return true\" href=javascript:downloadfile(this,'"+escape(arguments[1]) + "','" +
                                                          escape(arguments[2]) + "','" +
                                                          arguments[3] + "','" +
                                                          arguments[4] + "','" +
                                                          arguments[5] + "','" +
                                                          arguments[6] + "','" +
                                                          escape(arguments[7]) + "','" +
                                                          arguments[8] + "','" +
                                                          arguments[9] + "')>" +
    "                        <span id='btn_"+f_name+"'>Download</span></a></div>" +
    "                    </td>" +
    "                  </tr>"+
    "                </table>"+
    "              </td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "      </tr>"+
    "    </table>";
     
    document.getElementById("pls_"+f_name).innerHTML = document.getElementById('hld_pls_message').value;
    document.getElementById("btn_"+f_name).innerHTML = document.getElementById('hld_confirm').value;
    document.getElementById("txt_"+f_name).onkeydown = txt_keyword_KeyDown;
    document.getElementById("txt_"+f_name).focus();
  }  
  //Store current TR name
  previous_tr = "tr_"+f_name;
  parent.adjust_iframe_right_height(document.body.scrollHeight);  

}

function downloadfile() {
  f_name = unescape(arguments[7]);

  if(!check(f_name)){
    document.getElementById("msg_"+f_name).innerHTML = document.getElementById('hld_err_message').value;
    return;
  }
  else{
    if(document.getElementById("msg_"+f_name))
      document.getElementById("msg_"+f_name).innerHTML = ""; 
  }

	IE       = (navigator.appName.toLowerCase() == "microsoft internet explorer");
	Netscape = (navigator.appName.toLowerCase() == "netscape");
	
	counter_no = "1";
	url = "http://" + document.getElementById("hld_AkamaiURL").value + "/pub/ASUS/" + arguments[2].replace(/ /, "%20");
	
    ext = JustExt(arguments[2]);
    ext = ext.toLowerCase();
    if (ext == "pdf") {
        arguments[0].target = "_blank";
		    subwin = window.open(url,"","");
    }
    else {
		  document.getElementById("ifr_download").src = url;
			if(IE)
			  setTimeout("chk_url_exist()",1000);
    }      
    dlcount(arguments[0], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], counter_no); 
}

function p2p_click()
{
  var vNum = Math.round(Math.random()*65535);
  var f_name = arguments[7];
  
  //Hide previous TR
  if(document.getElementById(previous_tr))
    document.getElementById(previous_tr).style.display = "none";

  if(document.getElementById("hld_checked").value == "1")
  {
    downloadfile_dna(this, escape(arguments[1]), escape(arguments[2]), arguments[3], arguments[4], arguments[5], arguments[6], escape(arguments[7]), arguments[8], arguments[9]);
  }
  else
  {
    //Generate Code to document.getElementById("hld_ImgCode")
    GenCode();
      
    //Show current TR & DIV
    document.getElementById("tr_"+f_name).style.display = "inline";  
    document.getElementById("div_"+f_name).innerHTML = 
    "  <table width='100%' border='0' cellspacing='0' cellpadding='0'>"+
    "      <tr>"+
    "        <td width='200'><img src='Img.aspx?code="+encMe(document.getElementById("hld_ImgCode").value, "dot5.gif")+"' width='200' height='60' /></td>"+
    "        <td width='10'><table width='1' border='0' cellspacing='0' cellpadding='0'>"+
    "            <tr>"+
    "              <td width='1' height='80' background='../images/asus_download_dot5.gif'></td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "        <td width='425' style='padding-left:10px'>"+
    "            <strong><span id='pls_"+f_name+"' class='download_show'></span></strong><br>"+
    "            <span id='msg_"+f_name+"' class='download_show' style='color:#990000'></span>"+
    "          <table border='0' cellpadding='0' cellspacing='0' style='border-bottom-color:#191919'>"+
    "            <tr>"+
    "              <td align='left'><input type='text' name='textfield7' id='txt_"+f_name+"' style='width:100px' /></td>"+
    "              <td align='left' class='download_show' style='padding-left:20px; color:#990000'><table border='0' align='center' cellpadding='0' cellspacing='0'>"+
    "                  <tr>"+
    "                    <td><div id='button02'><a id='current' onmouseover=\"javascript:window.status='';return true\" href=javascript:downloadfile_dna(this,'"+escape(arguments[1]) + "','" +
                                                          escape(arguments[2]) + "','" +
                                                          arguments[3] + "','" +
                                                          arguments[4] + "','" +
                                                          arguments[5] + "','" +
                                                          arguments[6] + "','" +
                                                          escape(arguments[7]) + "','" +
                                                          arguments[8] + "','" +
                                                          arguments[9] + "')>" +
    "                        <span id='btn_"+f_name+"'>Download</span></a></div>" +
    "                    </td>" +
    "                  </tr>"+
    "                </table>"+
    "              </td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "      </tr>"+
    "    </table>";
     
    document.getElementById("pls_"+f_name).innerHTML = document.getElementById('hld_pls_message').value;
    document.getElementById("btn_"+f_name).innerHTML = document.getElementById('hld_confirm').value;
    document.getElementById("txt_"+f_name).onkeydown = txt_keyword_KeyDown;
    document.getElementById("txt_"+f_name).focus();
  } 
  //Store current TR name
  previous_tr = "tr_"+f_name;
  parent.adjust_iframe_right_height(document.body.scrollHeight);  

}

function downloadfile_dna() {
  f_name = unescape(arguments[7]);

  if(!check(f_name)){
    document.getElementById("msg_"+f_name).innerHTML = document.getElementById('hld_err_message').value;
    return;
  }
  else{
    if(document.getElementById("msg_"+f_name))
      document.getElementById("msg_"+f_name).innerHTML = ""; 
  }

	IE       = (navigator.appName.toLowerCase() == "microsoft internet explorer");
	Netscape = (navigator.appName.toLowerCase() == "netscape");
	dna_enabled = false;
	isFTP = false;


	counter_no = "1";
	url = "http://" + document.getElementById("hld_AkamaiURL").value + "/pub/ASUS/" + arguments[2].replace(/ /, "%20");
	
	dna_enabled = is_DNA_enabled();
  if(dna_enabled)
	  url = btdna({url:url, qos:0, service:'min_rate_data'});
  else{
    show_dna_tb(url, document.getElementById("langNormal").value);
    return;
  }
		
  ext = JustExt(arguments[2]);
  ext = ext.toLowerCase();
  if (ext == "pdf") {
    arguments[0].target = "_blank";
    subwin = window.open(url,"","");
  }
  else {
    document.getElementById("ifr_download").src = url;
    
	if(IE)
	  setTimeout("chk_url_exist()",1000);
  }
    
  dlcount(arguments[0], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], counter_no);  
}

function dlm_click()
{
  var vNum = Math.round(Math.random()*65535);
  var f_name = arguments[7];
  //Hide previous TR
  if(document.getElementById(previous_tr))
    document.getElementById(previous_tr).style.display = "none";
    
  if(document.getElementById("hld_checked").value == "1")
  {
    downloadfile_dlm(this, escape(arguments[1]), escape(arguments[2]), arguments[3], arguments[4], arguments[5], arguments[6], escape(arguments[7]), arguments[8], arguments[9]);
  }
  else
  { 
    //Generate Code to document.getElementById("hld_ImgCode")
    GenCode();
      
    //Show current TR & DIV
    document.getElementById("tr_"+f_name).style.display = "inline";  
    document.getElementById("div_"+f_name).innerHTML = 
    "  <table width='100%' border='0' cellspacing='0' cellpadding='0'>"+
    "      <tr>"+
    "        <td width='200'><img src='Img.aspx?code="+encMe(document.getElementById("hld_ImgCode").value, "dot5.gif")+"' width='200' height='60' /></td>"+
    "        <td width='10'><table width='1' border='0' cellspacing='0' cellpadding='0'>"+
    "            <tr>"+
    "              <td width='1' height='80' background='../images/asus_download_dot5.gif'></td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "        <td width='425' style='padding-left:10px'>"+
    "            <strong><span id='pls_"+f_name+"' class='download_show'></span></strong><br>"+
    "            <span id='msg_"+f_name+"' class='download_show' style='color:#990000'></span>"+
    "          <table border='0' cellpadding='0' cellspacing='0' style='border-bottom-color:#191919'>"+
    "            <tr>"+
    "              <td align='left'><input type='text' name='textfield7' id='txt_"+f_name+"' style='width:100px' /></td>"+
    "              <td align='left' class='download_show' style='padding-left:20px; color:#990000'><table border='0' align='center' cellpadding='0' cellspacing='0'>"+
    "                  <tr>"+
    "                    <td><div id='button02'><a id='current' onmouseover=\"javascript:window.status='';return true\" href=javascript:downloadfile_dlm("+
                                                          "this,'"+
                                                          escape(arguments[1]) + "','" +
                                                          escape(arguments[2]) + "','" +
                                                          arguments[3] + "','" +
                                                          arguments[4] + "','" +
                                                          arguments[5] + "','" +
                                                          arguments[6] + "','" +
                                                          escape(arguments[7]) + "','" +
                                                          arguments[8] + "','" +
                                                          arguments[9] + "')>" +
    "                        <span id='btn_"+f_name+"'>Download</span></a></div>" +
    "                    </td>" +
    "                  </tr>"+
    "                </table>"+
    "              </td>"+
    "            </tr>"+
    "          </table>"+
    "        </td>"+
    "      </tr>"+
    "    </table>";
     
    document.getElementById("pls_"+f_name).innerHTML = document.getElementById('hld_pls_message').value;
    document.getElementById("btn_"+f_name).innerHTML = document.getElementById('hld_confirm').value;
    document.getElementById("txt_"+f_name).onkeydown = txt_keyword_KeyDown;
    document.getElementById("txt_"+f_name).focus();
  }
  //Store current TR name
  previous_tr = "tr_"+f_name;
  parent.adjust_iframe_right_height(document.body.scrollHeight);  
}

function downloadfile_dlm() {
  f_name = unescape(arguments[7]);

  if(!check(f_name)){
    document.getElementById("msg_"+f_name).innerHTML = document.getElementById('hld_err_message').value;
    return;
  }
  else{
    if(document.getElementById("msg_"+f_name))
      document.getElementById("msg_"+f_name).innerHTML = ""; 
  }
  
	IE       = (navigator.appName.toLowerCase() == "microsoft internet explorer");
	Netscape = (navigator.appName.toLowerCase() == "netscape");
	
	counter_no = "1";
    url = "http://" + document.getElementById("hld_AkamaiURL").value + "/pub/ASUS/" + arguments[2].replace(/ /, "%20");

    ext = JustExt(arguments[2]);
    ext = ext.toLowerCase();
    if (ext == "pdf") {
        arguments[0].target = "_blank";
		    subwin = window.open(url,"","");
    }
    else {
		  if(is_DLM_supported())
		  {
			  if(IE)
			  {
			    if(is_DLM_enabled())
			      startDLM(url, document.getElementById("langNormal").value);
			    else
			      show_dlm(url, document.getElementById("langNormal").value);		  
			  }
			  else
			    startDLM_Java(url, document.getElementById("langNormal").value);
  			  
			  if(IE)
			    setTimeout("chk_url_exist()",1000);
		  }
		  else
		  {
		    document.getElementById("ifr_download").src = url;
		  }
    } 
    dlcount(arguments[0], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], counter_no); 
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function check(f_name)
{
  if(document.getElementById("hld_checked").value == "1")
    return true;

  if(document.getElementById("txt_"+f_name).value.toLowerCase() == document.getElementById("hld_ImgCode").value.toLowerCase())
  {
    document.getElementById("hld_checked").value = "1";
    return true;
  }
  else
  {
    document.getElementById("hld_checked").value = "0";
    return false;
  }
}

function txt_keyword_KeyDown(e) {
  var keyCode;
  
  if (NN)
    keyCode = e.keyCode;
  else
    keyCode = event.keyCode;
  
  if (keyCode == 13) {
    code = document.getElementById("current").href;
    if(!!(window.attachEvent && !window.opera))
    {//ie
      execScript(code); 
    }
    else
    {//not ie
//      window.eval(code);
      if(navigator.userAgent.indexOf("Firefox") >= 0)
      { 
        return false;
      }
      else
      {
        try
        {
          var evt = document.createEvent("MouseEvents");
          evt.initMouseEvent("click", true, true, window,
            0, 0, 0, 0, 0, false, false, false, false, 0, null);
          var cb = document.getElementById("current"); 
          cb.dispatchEvent(evt);
        } catch(err)
        {
          alert(err);
        }
      }
    }
    return false;
  }
  else
    return true;
}

function GenCode()
{
  var letters = "ABCDEFGHIJKLMNPQRSTUVWXYZ0123456789";
  var code = "";

  for(i=0; i<5; i++){
    var RanNum = Math.round(Math.random()*letters.length-1);
  	code = code + letters.substring(RanNum, RanNum+1);
  }

  document.getElementById("hld_ImgCode").value = code;
}


