var bottomw = 1;
var EMPTYIMG = "";

function twidth(empty_img){
 EMPTYIMG = empty_img;
 sw = screen.width;
 if(document.layers)
  sw = innerWidth;
 else{
  if(document.body.clientWidth)
   sw = document.body.clientWidth;
 }
 if(sw<1026)
  document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">");
 else{
  document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"1\">");
  bottomw = 864;
 }
}

function _reload(){
 window.location.reload();
}

function bottomwidth(){
 document.write('<div><img src="'+EMPTYIMG+'" width="'+bottomw+'" height="1" alt="" border="0"></div>');
 onresize = _reload;
	if(document.forms.length>0)
	{
		if(document.forms[0].elements.length>2)
		{
			onresize = null;
		}
	}
}

function _empty()
{
	return;
}

function go( u )
{
	location.href = u;
}

function chekEmail( fieldName )
{
	var field = document.getElementById( fieldName );
	var re = /^[a-zA-Z0-9_.\-]+\@[a-zA-Z0-9_.\-]+\.[a-zA-Z0-9_\-]+$/;

	if( field && ( field.value.length == 0 || re.exec( field.value ) == null ) )
	{
		alert( "Email address is not valid !" );
		field.focus();
		return false;
	}

	return true;
}

function changeElementClass(elementId, className) 
{
	element = document.getElementById(elementId);
	element.className = className;
}

function Trim(inputString) 
{
	while (inputString.substring(0,1) == ' ')
	{
		inputString = inputString.substring(1, inputString.length);
	}
	while (inputString.substring(inputString.length-1, inputString.length) == ' ')
	{
		inputString = inputString.substring(0,inputString.length-1);
	}
	return inputString;
}

function submitSearchByPage(formul, nPageIndex){
	var pos = this.location.href.indexOf('page_index=');
	if (pos == -1){
		var strAction = this.location.href +'&page_index='+nPageIndex;
	}else {
		
		var strAction = this.location.href.substring(0,pos-1)+'&page_index='+nPageIndex;
	}
	formul.method='POST';	
	formul.action = strAction;
	formul.target = "";
	formul.submit();
}

function MM_openBrWindow(theURL,winName,features,l,h) { //v2.0

 features=features + ",width="+l+",height="+h;
 if (screen.height) {
  var top = (screen.height-h)/2; 
  var left=(screen.width-l)/2;
  features=features+",top="+top+",left="+left;
 }
 window.open(theURL,winName,features );
}