// JavaScript Document
function valRadio(btn)//btn=document.form.radiobutton;//to validate radio button
{
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}


function CheckKeyInfo($char, $mozChar) {
if($mozChar != null)
	{ // Look for a Mozilla-compatible browser
	if($mozChar == 13) 
		{
		callsearchpage();
		}
	}
else 
	{ // Must be an IE-compatible Browser
	if($char == 13)
		{
		callsearchpage();
		}
	}

}



function validatecomment()
	{	
	var name=getVal('name');
	var country=getVal('country');
	var email=getVal('email');
	//var rate=document.getElementById('rate').value;
	var message=getVal('message');
	
	if(name=="")
		{
		alert('Please fill your name');
		return false;
		}
	else if(country=="0")
		{
		alert("Please select your country.");
		return false;
		}
	else if(email=="")
		{
		alert("Please fill your email address.");
		return false;
		}
	else if(!emailverify(email))
		{
		alert("Please fill a valid email address.");
		return false;
		}
	else if(message=="")
		{
		alert("Please fill the message.");
		return false;
		}
		
		
	return true;
	}
function callsearchpage()
	{
		var s=getVal('searchtext');
		var c=getVal('category');
		if(s=="")
		{
			alert("Please fill the keyword to search.");
		
		}
		else
		{
		window.location.href="search_"+s+"_in_"+c+"_1";
		}
		
	}
function validateregister()
	{
		var r1=getVal('memtype');
		var r2=getVal('uname');
		var r3=getVal('pw');
		var r4=getVal('confirmpw');
		var r6=getVal('name1');
		var r7=getVal('address1');
		var r8=getVal('address2');
		var r9=getVal('email');
		var r10=getVal('contactno');
		var r11=getVal('country');
		var r12=getVal('zip');
		if(r2=='')
			{
			alert('Please fill the username.');
			return false;
			}
		else if(r3=='')
			{
			alert('Please fill the password.');
			return false;
			}
		else if(r4=='')
			{
			alert('Please fill the confirm password.');
			return false;
			}
		else if(r3!=r4) 
			{
			alert('Your first and confirm password do not match.');
			return false;
			}
		else if(r6=='')
			{
			alert('Please fill the name.');
			return false;
			}
		else if(r7==' ' && r8==' ')
			{
			alert('Please fill at least one address.');
			return false;
			}
		else if(!emailverify(r9))
			{
			alert('Please fill a valid email address.');
			return false;
			}
		else if(r11=='0')
			{
			alert('Please select the country .');
			return false;
			}
		else if(r11=='0')
			{
			alert('Please select the country .');
			return false;
			}
		else if(r12=='')
			{
			alert('Please fill the zip / postal code .');
			return false;
			}
		return true;
		
	}

