var lgco = "sq-al|hy-am|be-by|cs-cz|da-dk|en-gb|kl-gl|el-gr|ja-jp|ko-kr|sv-se|sl-si|uk-ua|vi-vn|ca-XX|fa-XX|gl-XX|he-XX|ka-XX|kk-XX|sa-XX|div-XX|Syr-XX";
var user_lg, user_co;

function lib_bwcheck(){ //Browsercheck
	this.ver    = navigator.appVersion;
	this.agent  = navigator.userAgent;
	this.dom    = (document.getElementById)?1:0;
	this.opera5 = (this.agent.indexOf("Opera")>-1 && document.getElementById)?1:0;
	this.ie5    = (this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6    = (this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4    = (document.all && !this.dom && !this.opera5)?1:0;
	this.ie     = (this.ie4 || this.ie5 || this.ie6);
	this.mac    = (this.agent.indexOf("Mac")>-1);
	this.ns6    = (this.dom && parseInt(this.ver)>=5)?1:0; 
	this.ns4    = (document.layers && !this.dom)?1:0;
	this.bw     = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5);
	return this;
}

function ob(id){
  if      (bw.dom) obj = document.getElementById(id);
  else if (bw.ie4) obj = document.all[id];
  else if (bw.ns4) obj = document.anchors[id];
  return obj;
}

function getUserDetails(uln){
	
  //language & country detection (from JLM)
	var loc;
  switch (navigator.family){

		case "ie3":
    case "ie4":  // includes ie5 and ie6
			loc = navigator.userLanguage;
			break;
			
    case "aol":
    case "nn3":
    case "nn4":
    case "opera":
    case "gecko": // Mozilla, Netscape V6, V7  etc
      if (uln == "") loc = navigator.language;
      else           loc = uln;
			break;

    case "hotjava":
    default:
			loc = "     ";
			break;
  }
	
  user_lg = loc.substr(0,2).toLowerCase();	//user language
  
  //set the country from the loc language-country array
  user_co = 'XX';	//default value
  if (loc.substr(2,1) == "-"){
		user_co = loc.substr(3,2).toUpperCase();
	}
  else{
    var pos = lgco.indexOf(loc);
		if (pos < 0){	//not found case where no country = local language.
			user_co = loc.toUpperCase();
		}
		else{	// get the country from the local_ctry variable
			if (lgco.substr(pos+2,1) == "-") user_co = lgco.substr(pos+3,2).toUpperCase();
		}
  }
  if (user_co == 'XX') user_co = '';
  
	return;
}

function defined(obj){
	if (obj == null)
		return false;
	if (typeof(obj) == "undefined")
		return false;
	return true;
}

var bw = new lib_bwcheck();
