var helpwin = null;

function confirm_action(msg,url) {
  if (confirm(msg))
    document.location = url;
}

function help($loc) {
  if (helpwin == "object" || (helpwin != null && helpwin.document != null)) {
    helpwin.close();
    helpwin = null;
    t_url = url;
    t_w = w;
    t_h = h;
    setTimeout("openhelp($loc)",500)
  } else
    openhelp($loc);
}

function openhelp($loc) {
  helpwin=window.open($loc,"help",'screenX=100,screenY=100,width=350,height=350,scrollbars=yes');
}

function ImgShw(ID, width, height, alt)
{
  var scroll = "no";
  var top=0, left=0;
  if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
  if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
  if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
  width = Math.min(width, screen.width-10);
  height = Math.min(height, screen.height-28);
  var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
  wnd.document.write("<html><head>\n");
  wnd.document.write("<"+"script language='JavaScript'>\n");
  wnd.document.write("<!--\n");
  wnd.document.write("function KeyPress()\n");
  wnd.document.write("{\n");
  wnd.document.write("	if(window.event.keyCode == 27)\n");
  wnd.document.write("		window.close();\n");
  wnd.document.write("}\n");
  wnd.document.write("//-->\n");
  wnd.document.write("</"+"script>\n");
  wnd.document.write("<title>"+(alt == ""? "Image":alt)+"</title></head>\n");
  wnd.document.write("<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\">\n");
  wnd.document.write("<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\">");
  wnd.document.write("</body>");
  wnd.document.write("</html>");
  wnd.document.close();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function LanguageHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}


function Set_Cookie( name, value, expires, path, domain, secure )  
{ 
var today = new Date(); 
today.setTime( today.getTime() ); 
if ( expires ) 
{ 
   expires = expires * 1000 * 60 ; 
} 
var expires_date = new Date( today.getTime() + (expires) ); 
document.cookie = name + "=" +escape( value ) + 
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +  
	( ( path ) ? ";path=" + path : "" ) +  
	( ( domain ) ? ";domain=" + domain : "" ) + 
	( ( secure ) ? ";secure" : "" ); 
} 



function ChooseLang(lang_id,cur_lang)
{   
  if(lang_id==""){ 
     tmp_lang = "en";
  }
  else{
     tmp_lang = lang_id;
  }

  Set_Cookie("tmp_lang",tmp_lang,3,"/");


  if(lang_id=="en")
  {
    temp = document.location.pathname;
    if(cur_lang!=""){
        url = temp.substr(temp.indexOf("/"+cur_lang,0)+3);
    }
    else{
        url = "";
    }
    document.location = "http://"+document.location.hostname+url;
  }
  else
  {
    if(lang_id == 'international.html') {document.location = "http://"+document.location.hostname+"/"+lang_id;}
    else{
        if(lang_id!=cur_lang)
        {
           temp = document.location.pathname;
           if(cur_lang!='en'){
              url = temp.substr(temp.indexOf("/"+cur_lang,0)+3);
           }
           else{
              url = temp;
           }
           linkvar = "/"+lang_id;
           if(url!='') linkvar = linkvar+url;
           document.location = "http://"+document.location.hostname+linkvar;
                
        }
    }
  }
  
    
}


function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function hideDiv(id)
{
  if (id != null)
    id.style.display = 'none';
}
