// JavaScript Document
var InternetExplorer = navigator.appName.indexOf('Microsoft') != -1;
var client_browse = '';
if(document.getElementById)
{client_browse = 'ie5';}	// IE5+,NN6+	document.getElementById('id')
else if(document.all)
{client_browse = 'ie4';}	// IE4	document.all('id');
else if(document.layers)
{client_browse = 'ns4';}	// NN4	document.layers['id'];

function $(strname){
	switch(client_browse){
		case 'ie5':
			return document.getElementById(strname);
			break;
		case 'ns4':
			return document.layers[strname];
			break;
		default:	// 'ie4'
			return document.all(strname);
			break;
	}
}

function checkformat(src){
	check = new String(src);
	check = check.toLowerCase();
	source = new String("0123456789");
	for(i=0; i<check.length; i++){
		pos = source.indexOf(check.charAt(i));
		if(pos < 0)
			return false;
	}
	return true;
}

function jumppage(v,p,c){
	if(checkformat(v)){
		if(!(v>c || v<=0)){
			if(v==1){
				this.location.href = p;
			}else{
				this.location.href = p + v +'/';
			}
		}
	}
}

function newsjumppage(v,p,c){
	if(checkformat(v)){
		if(!(v>c || v<=0)){
			if(v==1){
				this.location.href = p+'news/index.html';
			}else{
				this.location.href = p +'news/index_'+v +'.html';
				
			}
		}
	}
}

function p_jumppage(v,p,c){
	if(checkformat(v)){
		if(!(v>c || v<=0)){
			if(v==1){
				this.location.href = p;
			}else{
				this.location.href = p +'index_'+ v +'.html';
			}
		}
	}
}

function jumppage2(v,rn,c,query){
	if(checkformat(v)){
		if(!(v>c || v<=0)){
			this.location.href = 'search.asp?rn='+ rn +'&pid='+ v +'&query='+ query +'&space=0';
		}
	}
}

function checkFrom(value){
	if($('keyword').value=='Enter Keyword' || $('keyword').value=='') return false;
}

function checkMail(s){
	var pattern=/^[\w\.-]+@[\w\.-]+\.\w+$/i;
	if(pattern.test(s)){
		return true;
	}else{
		return false;
	}
}

function me_submit(obj){
	if(obj.company.value==''){
		alert('Please enter your Company Name.');
		obj.company.focus();
		return false;
	}
	if(obj.linkname.value==''){
		alert('Please enter your Visitor.');
		obj.linkname.focus();
		return false;
	}
	if(obj.email.value==''){
		alert('Please enter your Email.');
		obj.email.focus();
		return false;
	}else if(!checkMail(obj.email.value)){
		alert('Please enter a valid Email Address.');
		obj.email.focus();
		return false;
	}
	if(obj.content.value==''){
		alert('Please enter your Comments.');
		obj.content.focus();
		return false;
	}
	$('breset').disabled=true;
	$('submit').disabled=true;
	$('submit').value='Wait a second...';
	obj.action='/include/send.asp?'+Math.random();
	return true;
}

function moveBF(pid){fid=document.getElementById(pid)
cc=fid.height-225;
if(fid.offsetTop+cc>0){fid.style.marginTop=(fid.offsetTop-5)+"px";
MF=setTimeout("moveBF('"+pid+"')",10)}}
function MoveBF(pid){fid=document.getElementById(pid)
if(fid.offsetTop<-10){fid.style.marginTop=(fid.offsetTop+5)+"px";
if(typeof MF!="undefined")clearTimeout(MF);mf=setTimeout("MoveBF('"+pid+"')",10)}}
