function getElem(name) {
	if (document.getElementById) // this is the way the standards work
		elem = document.getElementById(name);
	else if (document.all) // this is the way old msie versions work
		elem = document.all[name];
	else if (document.layers) // this is the way nn4 works
		elem = document.layers[name];
	return elem;
}

function switchDiv(div) {
	elemnt = getElem(div);
	if (elemnt.style.display == 'block') {
		elemnt.style.display = 'none';
	} else {
		elemnt.style.display = 'block';
	}
}

function switchClass(itemname, classname) {
	if (itemname != null) {
		getElem(itemname).className = classname;
	}
}

function showDiv(div){
	elemnt = getElem(div);
	elemnt.style.display = 'block';
}

function hideDiv(div){
	elemnt = getElem(div);
	elemnt.style.display = 'none';		
}

function switchLogin(divA,divB){
	showDiv(divA);
	hideDiv(divB);
}

function CalcKeyCode(aChar) {
  var character = aChar.substring(0,1);
  var code = aChar.charCodeAt(0);
  return code;
}

function checkNumber(val) {
  var strPass = val.value;
  var strLength = strPass.length;
  var lchar = val.value.charAt((strLength) - 1);
  var cCode = CalcKeyCode(lchar);
  
  if (cCode < 48 || cCode > 57 ) 
  {
	  if ( cCode != 43 )
	  {
		  var myNumber = val.value.substring(0, (strLength) - 1);
		  val.value = myNumber;
	  }
  }
  return false;
}


function goUrl(url) {
	window.location = url;

}


function moveWrapper(){
	//alert($('body').width());
	
	w = $('body').width();
	ww = $('#wrapper').outerWidth();

	tw = w - ww;
	
	if(tw < 0){
		
		chng = Math.abs(tw) / 2 ;
		
		if(chng > 130){
			 $('#wrapper').css('marginLeft',-130);
		}else{
			 $('#wrapper').css('marginLeft',-chng);
		}
		
	}else{
		chng = (tw) / 2 ;
		$('#wrapper').css('marginLeft',chng);
	}
}

function popup(url) 
{
 var width  = 400;
 var height = 270;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=no';
 params += ', status=no';
 params += ', toolbar=no';
 params += ', urllink=no';
 newwin=window.open(url,'windowname', params);
 if (window.focus) {newwin.focus();}
 return false;
}

function iniSPane2(){

	
		$('.c3col_2').jScrollPane({showArrows: true,
				verticalDragMinHeight: 6,
				verticalDragMaxHeight: 6});

}

function iniSPane3(){

	
	$('.c3col_3').jScrollPane({showArrows: true,
			verticalDragMinHeight: 6,
			verticalDragMaxHeight: 6});

}

var c3col_X_api = null;

function iniSPaneX(){

	var pane = $('.c3col_X');
	pane.jScrollPane(
		{
			showArrows: true,							
			verticalDragMinHeight: 6,
			verticalDragMaxHeight: 6
		}
	);
	
	//global
	c3col_X_api = pane.data('jsp');
  $("#slides ul").css("display","table");

}


function fixPng(){
	
	jQuery(function($) {
	    $("img[@src$=png], #wrapper").pngfix();
	});
}



