var curCol = 0;
var w = document.body.clientWidth;

var flash = false;
var plugin;
var version = 6;

if (navigator.plugins) {
	if (navigator.plugins["Shockwave Flash"]) {
		plugin = navigator.plugins["Shockwave Flash"].description;
		installVersion = plugin.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
		if ( installVersion[0] > version ) {
		    flash = true;
		}
	} else {
		if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)){
			var vb = '<script language="vbscript">\n'
				+ '  on error resume next\n'
				+ '  flash = IsObject(CreateObject('
				+ '     "ShockwaveFlash.ShockwaveFlash.' + version + '"))\n'
				+ '<' + '/script>';
			document.write(vb);
		}
	}
}

function setHeader(id){
 if(w < 900){
  document.getElementById(id).style.width = '98%';
 }else{
  if(w < 1200){
   document.getElementById(id).style.width = '92%';
  }else{
   document.getElementById(id).style.width = '1200';
  }
 }
}

function setShadow(){
 if(w<900){
  document.getElementById("table_shadow_col2").style.backgroundPosition = document.getElementById("table_shadow_col3").style.backgroundPosition = document.getElementById("table_shadow_col4").style.backgroundPosition = 'center 7px';
  document.getElementById("table_shadow_right").style.paddingRight = '0px';
 }else{
  document.getElementById("table_shadow_col2").style.backgroundPosition = document.getElementById("table_shadow_col3").style.backgroundPosition = document.getElementById("table_shadow_col4").style.backgroundPosition = 'left 7px';
  document.getElementById("table_shadow_right").style.paddingRight = '40px';
 }

 if(curCol > 0){
  document.getElementById("table_shadow_col"+curCol).style.backgroundPosition = 'left 7px';
 }
}

function showLogin(){
// document.getElementById('login').style.display=(document.getElementById('login').style.display != 'block' ? 'block' : 'none');
       var agt = navigator.userAgent.toLowerCase();
       var is_bsd   = (agt.indexOf("bsd") != -1);
       var is_x11   = (agt.indexOf("x11") != -1);
       var is_linux = (agt.indexOf("linux") != -1);
       var is_mac   = (agt.indexOf("mac") != -1);
       obj = document.getElementById('login').style;
       if ( is_bsd || is_x11 || is_linux || is_mac ) {
             obj.top = '20px';
       }
       obj.display = (obj.display != 'block' ? 'block' : 'none');
}

function showLogin2(){
// document.getElementById('login2').style.display=(document.getElementById('login2').style.display != 'block' ? 'block' : 'none');
       var agt = navigator.userAgent.toLowerCase();
       var is_bsd   = (agt.indexOf("bsd") != -1);
       var is_x11   = (agt.indexOf("x11") != -1);
       var is_linux = (agt.indexOf("linux") != -1);
       var is_mac   = (agt.indexOf("mac") != -1);
       obj = document.getElementById('login2').style;
       if ( is_bsd || is_x11 || is_linux || is_mac ) {
             obj.top = '20px';
       }
       obj.display = (obj.display != 'block' ? 'block' : 'none');
}

function inputText (input, dft_value, cssFilled, cssEmpty){
	var thisCopy = this;
	this.Input = input;
	this.dft_Value = dft_value;
	this.CssFilled = cssFilled;
	this.CssEmpty = cssEmpty;

	this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()});
	this.setupEvent (this.Input, 'blur',  function() {return thisCopy.onBlur()});
	this.setupEvent (this.Input, 'keydown', function() {return thisCopy.onKeyDown()});

    if (input.value == dft_value) this.onBlur()
    return this
}

inputText.prototype.setupEvent = function (elem, eventType, handler) {
	if (elem.attachEvent){elem.attachEvent ('on' + eventType, handler)} //IE
	if (elem.addEventListener){elem.addEventListener (eventType, handler, false)} //DOM
}

inputText.prototype.onFocus = function() {
	if (this.Input.value == this.dft_Value) {this.Input.value = ''}
	else {this.Input.className = 'full'}
}

inputText.prototype.onKeyDown = function() {this.Input.className = 'full'}

inputText.prototype.onBlur = function() {
	if (this.Input.value == '' || this.Input.value == this.dft_Value)
	{
		this.Input.value = this.dft_Value;
		this.Input.className = this.CssEmpty
	}
	else {this.Input.className = ''}
}

function ShowHide(elem, icon_elem){
  var s = elem.style;
  s.display = (s.display != 'none') ? 'none': '';
  if(icon_elem) { icon_elem.innerHTML = (s.display != 'none') ? '[+]': '[&ndash;]'; }
}
