﻿// JScript File
//Menu center
function resize() {      
  var width = window.screen.width-20;
  var menuWidth = width-505;
  menuWidth = menuWidth*24/100;
  emenuTab1 = document.getElementById("AdDivDv01");
  emenuTab2 = document.getElementById("AdDivDv02");
  emenuTab3 = document.getElementById("AdDivDv03");
  emenuTab4 = document.getElementById("AdDivDv04");
  emenuTab1.style.width = menuWidth;
  emenuTab2.style.width = menuWidth;
  emenuTab3.style.width = menuWidth;
  emenuTab4.style.width = menuWidth;
  
  var el = window.document.getElementById("IDbody");
  var eForm = window.document.getElementById("aspnetForm");
  var eBanner = window.document.getElementById("homeBanner");
  var eHomeCenter = window.document.getElementById("homeCenter");
  
  if (width > 1024){
      el.style.width = width;
      eForm.style.width = width;
      eBanner.style.width = width;  
      eHomeCenter.style.width=width-451;
  }else{      
      el.style.width = 1000;
      eForm.style.width = 1000;
      eBanner.style.width = 1000;  
      eHomeCenter.style.width= 549;      
  }
}

function resizeProducts() {
          var width = window.screen.width-20;
          var el = window.document.getElementById("IDbody");
          var eForm = window.document.getElementById("aspnetForm");
          var eBanner = window.document.getElementById("homeBanner");
          var econtentProSub = window.document.getElementById("contentProSub");
          
          if (width > 1024){
              el.style.width = width;
              eForm.style.width = width;      
              eBanner.style.width = width;
              econtentProSub.style.width = width-190;
          }else{      
              el.style.width = 1000;
              eForm.style.width = 1000;
              eBanner.style.width = 1000; 
              econtentProSub.style.width = 810;
          }
          
        }

function resizeFull() {
  var width = window.screen.width-20;
  var el = window.document.getElementById("IDbody");
  var eForm = window.document.getElementById("aspnetForm");
  var eBanner = window.document.getElementById("homeBanner");
  var eContentfull = window.document.getElementById("Contentfull");
  
  if (width > 1024){
      el.style.width = width;
      eForm.style.width = width; 
      eBanner.style.width = width;     
      eContentfull.style.width = width;
  }else{      
      el.style.width = 1000;
      eForm.style.width = 1000;
      eBanner.style.width = 1000; 
      eContentfull.style.width = 1000;
  }
  
}


//Tab Menu
function AdFindObjectID(idName)
{
	return document.getElementById(idName);
}
//-----------------------------------------------
function SetBlockAdWebClient(strName,intTabLength)
{
    try
    {
        var strDivName = strName.substring(0,strName.length-2);
        for (var i = 1; i <= intTabLength; i++)
        {
            var stri = strDivName;
            if (i<10) 
                stri = strDivName+'0'+i;
            else 
                stri = strDivName+i;
            AdFindObjectID(stri).className = "TabNews_Selected";
            AdFindObjectID(AdFindObjectID(stri).headers).style.display = "none";
        }
        AdFindObjectID(strName).className = "TabNews_default";
        AdFindObjectID(AdFindObjectID(strName).headers).style.display = "block";
    }
    catch(ex){}
}

//Ajax Loader
var xmlhttp=false;
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp=false;
        }
    }

    if (!xmlhttp && window.createRequest) {
        try {
            xmlhttp = window.createRequest();
        } catch (e) {
            xmlhttp=false;
        }
    }    
    var please_wait = "Please wait...";

function open_url(url, targetId) {
    if(!xmlhttp)return false;
    var e=document.getElementById(targetId);if(!e)return false;
    if(please_wait)e.innerHTML = please_wait;
    xmlhttp.open("GET", url, true);
    xmlhttp.onreadystatechange = function() { response(url, e); }
    try{
        xmlhttp.send(null);
    }
    catch(l){
        while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
        e.appendChild(document.createTextNode("request failed"));
    }
}
function response(url, e) {
    if(xmlhttp.readyState != 4)return;
    var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the following error code: " + xmlhttp.status+" "+xmlhttp.statusText;
    var d=document.createElement("div");
    d.innerHTML=tmp;
    setTimeout(function(){
    while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
    e.appendChild(d);
    },10)
    }
 
 
 /////////////////////////
 // ----- Popup Control ---------------------------------------------------------


function at_display(x)
{
  win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ----- Show Aux -----

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top-73 +'px';
//  c.style.left       = left+'3px';
  c.style.left       = '21%';  
  c.style.visibility = "visible";
}

// ----- Show -----

function at_show()
{
  p = document.getElementById(this["at_parent"]);
  c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

// ----- Hide -----

function at_hide()
{
  c = document.getElementById(this["at_child"]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ----- Click -----

function at_click()
{
  p = document.getElementById(this["at_parent"]);
  c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible") at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
}


function at_attach(parent, child, showtype, position, cursor)
{
  p = document.getElementById(parent);
  c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}