// 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 +'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 checkMail(s){
	var pattern=/^[\w\.-]+@[\w\.-]+\.\w+$/i;
	if(pattern.test(s)){
		return true;
	}else{
		return false;
	}
}

function SendThis(){
	if($('company').value==''){
		alert('Please enter your Company Name.');
		$('company').focus();
		return false;
	}
	if($('linkname').value==''){
		alert('Please enter your Visitor.');
		$('linkname').focus();
		return false;
	}
	if($('email').value==''){
		alert('Please enter your Email.');
		$('email').focus();
		return false;
	}else if(!checkMail($('email').value)){
		alert('Please enter a valid Email Address.');
		$('email').focus();
		return false;
	}
	if($('content').value==''){
		alert('Please enter your Comments.');
		$('content').focus();
		return false;
	}
	$('breset').disabled=true;
	$('submit2').disabled=true;
	$('submit2').value='Wait a second...';
    document.myform.submit();
}