var xmlHttp

function checkpwd() 
{

missinginfo = "";
if ((document.getElementById("txtpwd").value == "")||(document.getElementById("txtuser").value == "")) {
missinginfo += "\n  * Please enter User and Password ";
}

if (missinginfo != "") {
alert(missinginfo);
return false;
}
else return true;
}


//=============================================


function checkactivate(str)
{ 
//alert(str);
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
var url="/include/ck_activate.php"
url=url+"?q="+str
xmlHttp.onreadystatechange=activatestateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function activatestateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 		{ 
 			document.getElementById("activateSt").value = xmlHttp.responseText;		
			if ( xmlHttp.responseText != 1 )
				{ 
				 	document.getElementById("activatetxtHint").innerHTML = xmlHttp.responseText ;
					document.getElementById("int_code").disabled = "disabled"; 
				}
			else
				{
					document.getElementById("activatetxtHint").innerHTML= "<font color='#FF0000'>The S/N Number you enter is not correct</font>" ;	
					document.getElementById("int_code").disabled = ""; 
				}
 		} 
}


//=============================================

function CheckSN(str)
{ 
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
var url="../include/ck_sn.php"
url=url+"?q="+str
xmlHttp.onreadystatechange=snstateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function snstateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 		{ 
 			document.getElementById("activateSt").value = xmlHttp.responseText;		
			if ( xmlHttp.responseText != 1 )
				{ 
				 	document.getElementById("activatetxtHint").innerHTML = xmlHttp.responseText ;
				}
			else
				{
					document.getElementById("activatetxtHint").innerHTML= "<font color='#FF0000'>The S/N Number you enter is not correct</font>" ;	
				}
 		} 
}

//=============================================

function checkitemcode(str)
{ 
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
var url="/include/ck_itemcode.php"
url=url+"?q="+str
xmlHttp.onreadystatechange=itemcodestateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function itemcodestateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 		{ 
 			document.getElementById("activateSt").value = xmlHttp.responseText;		
			if ( xmlHttp.responseText != 1 )
				{ 
				 	document.getElementById("activatetxtHint").innerHTML = xmlHttp.responseText ;
					document.getElementById("item_code").disabled="disabled"; 
				}
			else
				{
					document.getElementById("activatetxtHint").innerHTML= "<font color='#FF0000'>The code you enter is not correct</font>" ;	
					document.getElementById("item_code").disabled = "";
				}
 		} 
}

//=============================================

function checkmail(str)
{ 
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
var url="/include/ck_mail.php"
url=url+"?q="+str
xmlHttp.onreadystatechange=mailstateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function mailstateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 		{ 
			document.getElementById("mailSt").value = xmlHttp.responseText;		
			if ( xmlHttp.responseText != 1 )
				{ 
				 	document.getElementById("mailtxtHint").innerHTML = xmlHttp.responseText ;
				}
			else
				{
					document.getElementById("mailtxtHint").innerHTML= "<img src='ok.jpg' width='12' height='12' >" ;	
				}

		}

}

//===================================================

function checkcmail(str1,str2)
{ 
if (str1 != str2)
	{
		document.getElementById("cmailtxtHint").innerHTML="<font color='#FF0000'>The entered email don&#8217;t match with above address. </font>";
	}
else
	{
		document.getElementById("cmailtxtHint").innerHTML="<img src='ok.jpg' width='12' height='12' >"
	}
}

//===================================================

function checkmailreg(str)
{ 
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
var url="/include/ck_mailreg.php"
url=url+"?q="+str
xmlHttp.onreadystatechange=mailregstateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function mailregstateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 		{ 
 			var mmm= "<font color='red'>";
			mmm += xmlHttp.responseText ;
			mmm += "</font>";
			document.getElementById("mailregSt").value = xmlHttp.responseText;		
			if ( xmlHttp.responseText != 1 )
				{ 
				 	document.getElementById("mailregtxtHint").innerHTML = mmm ;
				}
			else
				{
					document.getElementById("mailregtxtHint").innerHTML= "" ;	
				}
			
			
 		} 
} 

//===================================================


function checkfname(str)
{ 
	if (str != "")
	{
		document.getElementById("fnametxtHint").innerHTML="<img src='ok.jpg' width='12' height='12' >"
	}
	else
	{
		document.getElementById("fnametxtHint").innerHTML="<font color='#FF0000'>Please enter your first name.</font>"
	}
}

//===================================================

function checksname(str)
{ 
	if (str != "")
	{
		document.getElementById("snametxtHint").innerHTML="<img src='ok.jpg' width='12' height='12' >"
	}
	else
	{
		document.getElementById("snametxtHint").innerHTML="<font color='#FF0000'>Please enter your surname.</font>"
	}
}

//===================================================


function checkcountry(str)
{ 
	if (str != "")
	{
		document.getElementById("countrytxtHint").innerHTML="<img src='ok.jpg' width='12' height='12' >"
	}
	else
	{
		document.getElementById("countrytxtHint").innerHTML="<font color='#FF0000'>Please chose your country of residence</font>"
	}
}

//===================================================

function checkverify(str1,str2)
{ 
if (str1 != "")
{
	if (str1 != str2)
		{
			document.getElementById("verifytxtHint").innerHTML="<font color='#FF0000'>The verification code is not correct, please try again. </font>"
		}
	else
		{
			document.getElementById("verifytxtHint").innerHTML="<img src='ok.jpg' width='12' height='12' >"
		}
}
else
{
	document.getElementById("verifytxtHint").innerHTML="<font color='#FF0000'>Please enter verification code.</font>"
}
}

//===================================================

function checkgender(str)
{ 
	if (str != "")
	{
		document.getElementById("gendertxtHint").innerHTML="<img src='ok.jpg' width='12' height='12' >"
	}
	else
	{
		document.getElementById("gendertxtHint").innerHTML="<font color='#FF0000'>Please select you gender.</font>"
	}
}
//===================================================

function checkFields() 
{

missinginfo = "";

if ($("#email").val() =="")
{
	missinginfo += "\n  * Email address";
}
else if($("#mailSt").val() != 1 )
{
	missinginfo += "\n  * Email address";
}

if ($("#c_mail").val() != $("#email").val()) {
	missinginfo += "\n  * Retype email";
}

if ($("#fname").val() =="") {
	missinginfo += "\n  * Firstname";
}

if ($("#sname").val() == "") {
	missinginfo += "\n  * Surname";
}

if ($("#gender").val() =="" ){
	missinginfo += "\n  * Gender";
}

if ($("#country").val() == "") {
	missinginfo += "\n  * Country";
}

if ($("#activateSt").val() == "") 
{
	missinginfo += "\n  * S/N Number or Item code";
}
else if ($("#activateSt").val() == 1)
{
	missinginfo += "\n  * S/N Number or Item code";
}


if ($("#string1").val() != $("#string2").val()) {
	missinginfo += "\n  * Verification key";
}

if($("#status").attr("checked") == false) { 
	missinginfo += "\n  * Agreement condition";
}

if (missinginfo != "") {
	missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
	alert(missinginfo);
	return false;
}
else return true;
}

//===================================================

function checkFieldsReg() 
{

missinginfo = "";

if ($("#email").val() =="")
{
	missinginfo += "\n  * Email address";
}
else if($("#mailSt").val() != 1 )
{
	missinginfo += "\n  * Email address";
}

if ($("#c_mail").val() != $("#email").val()) {
	missinginfo += "\n  * Retype email";
}

if ($("#sn_number").val() == "") 
{
	missinginfo += "\n  * S/N Number";
}


if ($("#string1").val() != $("#string2").val()) {
	missinginfo += "\n  * Verification key";
}

if (missinginfo != "") {
	missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
	alert(missinginfo);
	return false;
}
else return true;
}

//===================================================

function checksurvey() 
{

missinginfo = "";
if (document.getElementById("score").value=="") 
{
	missinginfo += "* Please give your score. How likely?";
}

if (missinginfo != "") {
alert(missinginfo);
return false;
}
else return true;
}

//===================================================

function checkmailreg_submit()
{
			var missinginfo = "";
			var ddd = document.getElementById("mailregSt").value 
			//alert ( "test befor If...else = " + ddd )
			if ( ddd != 1 )
				{
					missinginfo = "* Please check your email address "					
				}
	

			if (missinginfo != "") 
				{
					alert(missinginfo);
					return false;
				}
			else 
				{
					return true;
				}
}

//===================================================


function checkFieldsEdit() 
{

missinginfo = "";

if (document.getElementById("fname").value =="") {
	missinginfo += "\n - * Firstname";
}

if (document.getElementById("sname").value == "") {
missinginfo += "\n - * Surname";
}

if (document.getElementById("gender").value =="" ){
missinginfo += "\n - * Gender";
}

if (document.getElementById("country").value == "") {
missinginfo += "\n - * Country";
}

if (missinginfo != "") {
missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
alert(missinginfo);
return false;
}
else return true;
}

//======================================================
function checkFieldsEdit_activate() 
{
	if(form32.fname.value==""){
	alert("Please input your first name");
	form32.fname.focus();
	return false; 
	}
	if(form32.sname.value==""){
	alert("Please input your last name");
	form32.sname.focus();
	return false; 
	}
	if(form32.gender.value==""){
	alert("Please select your gender");
	form32.gender.focus();
	return false; 
	}
	if(form32.country.value==""){
	alert("Please select your country");
	form32.country.focus();
	return false; 
	}
	if(form32.pcountry.value=="0"){
	alert("Please select the country's store you bought the product(s)");
	form32.pcountry.focus();
	return false; 
	}
	//if(form32.pstate.value==""){
//	alert("Please select the state you bought the product(s)");
//	form32.pstate.focus();
//	return false; 
//	}
	return true;
}
//======================================================
function CheckClaimPage1()
{

missinginfo = "";

if (document.getElementById("fname").value =="") {
	missinginfo += "\n  * Firstname";
}

if (document.getElementById("sname").value == "") {
missinginfo += "\n  * Surname";
}

if (document.getElementById("address").value =="" ){
missinginfo += "\n  * Address";
}

if (document.getElementById("city").value =="" ){
missinginfo += "\n  * City";
}

if (document.getElementById("zip").value =="" ){
missinginfo += "\n  * Zipcode";
}

if (document.getElementById("country").value == "") {
missinginfo += "\n  * Country";
}

if (missinginfo != "") {
	missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
	alert(missinginfo);
	return false;
}
else 
{
	document.getElementById('tb_page2').style.display='';
	document.getElementById('tb_page1').style.display='none';
	return true;
}
}
//======================================================

function CheckClaimPage2()
{

missinginfo = "";

if ((document.getElementById("dm1").checked == false)&&(document.getElementById("dm2").checked == false)&&(document.getElementById("dm3").checked == false)&&(document.getElementById("dm4").checked == false))  {
	missinginfo += "\n  * Select bloken part ";
}

if (document.getElementById("detail").value == "") {
missinginfo += "\n  * Cause of the damage";
}

if (document.getElementById("UploadedFile_0").value =="" ){
missinginfo += "\n  * Upload photos";
}


if (missinginfo != "") {
	missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
	alert(missinginfo);
	return false;
}
else 
{
	document.getElementById('tb_page3').style.display='';
	document.getElementById('tb_page2').style.display='none';
	return true;
}
}
//======================================================

function CheckClaimPage3()
{

missinginfo = "";

if (document.getElementById("p_store").value =="" ){
missinginfo += "\n  * Store name";
}

if (document.getElementById("p_city").value =="" ){
missinginfo += "\n  * City of purchase";
}

if (document.getElementById("p_country").value =="" ){
missinginfo += "\n  * Country of purchase";
}

if (document.getElementById("p_tel").value =="" ){
missinginfo += "\n  * Telephone of purchase";
}

if ((document.getElementById("p_price").value =="" )||(document.getElementById("p_currency").value =="" )){
missinginfo += "\n  * Price or Currency";
}
 
if (document.getElementById("confirm1").checked == false) {
missinginfo += "\n  * Information confirm";
}


if (missinginfo != "") {
	missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
	alert(missinginfo);
	return false;
}
else 
{
	document.getElementById('tb_page4').style.display='';
	document.getElementById('tb_page3').style.display='none';
	//========disable submit button============
	document.form15.Submit3.disabled=true;
	document.form15.submit();
	//========end of disable submit button=====
	return true;
}
}


//======================================================
function CheckClaimPage3_1()
{

missinginfo = "";

if (document.getElementById("p_store").value =="" ){
missinginfo += "\n  * Store name";
}

if (document.getElementById("p_city").value =="" ){
missinginfo += "\n  * City of purchase";
}

if (document.getElementById("p_country").value =="" ){
missinginfo += "\n  * Country of purchase";
}

if (document.getElementById("p_tel").value =="" ){
missinginfo += "\n  * Telephone of purchase";
}

if ((document.getElementById("p_price").value =="" )||(document.getElementById("p_currency").value =="" )){
missinginfo += "\n  * Price or Currency";
}
 
if (document.getElementById("confirm1").checked == false) {
missinginfo += "\n  * Information confirm";
}


if (missinginfo != "") {
	missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
	alert(missinginfo);
	return false;
}
else 
{
	//========disable submit button============
	document.form15.Submit3.disabled=true;
	document.form15.submit();
	//========end of disable submit button=====
	return true;
}
}


//======================================================

function CheckClaimPage4()
{

missinginfo = "";

if (document.getElementById("h_replaceitem").value=="" ){
missinginfo += "\n  * Select replace item";
}

if ((document.getElementById("h_replaceitem").value=="not_select")&&(document.getElementById("replacecomment").value =="" )){
missinginfo += "\n  * Input comment";
}


if (missinginfo != "") {
	missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
	alert(missinginfo);
	return false;
}
else 
{
	//========disable submit button============
	document.form15.Submit4.disabled=true;
	document.form15.submit();
	//========end of disable submit button=====
	return true;
}

}


//======================================================


function checkclaim() 
{

missinginfo = "";

if (document.getElementById("fname").value =="") {
	missinginfo += "\n  * Firstname";
}

if (document.getElementById("sname").value == "") {
missinginfo += "\n  * Surname";
}

if (document.getElementById("address").value =="" ){
missinginfo += "\n  * Address";
}

if (document.getElementById("city").value =="" ){
missinginfo += "\n  * City";
}

if (document.getElementById("zip").value =="" ){
missinginfo += "\n  * Zipcode";
}

if (document.getElementById("country").value == "") {
missinginfo += "\n  * Country";
}

if ((document.getElementById("dm1").checked == false)&&(document.getElementById("dm2").checked == false)&&(document.getElementById("dm3").checked == false)&&(document.getElementById("dm4").checked == false)&&(document.getElementById("dm5").checked == false))  {
	missinginfo += "\n  * Select bloken part ";
}

if (document.getElementById("detail").value == "") {
missinginfo += "\n  * Cause of the damage";
}

if (document.getElementById("p_store").value =="" ){
missinginfo += "\n  * Store name";
}

if (document.getElementById("p_city").value =="" ){
missinginfo += "\n  * City of purchase";
}

if (document.getElementById("p_country").value =="" ){
missinginfo += "\n  * Country of purchase";
}

if (document.getElementById("p_tel").value =="" ){
missinginfo += "\n  * Telephone of purchase";
}

if ((document.getElementById("p_price").value =="" )||(document.getElementById("p_currency").value =="" )){
missinginfo += "\n  * Price or Currency";
}

if (document.getElementById("UploadedFile_0").value =="" ){
missinginfo += "\n  * Upload photos";
}

if (document.getElementById("confirm1").checked == false) {
missinginfo += "\n  * Information confirm";
}

if (missinginfo != "") {
missinginfo ="Please check field(s):\n" + "---------------------" + missinginfo ;
alert(missinginfo);
return false;
}
else return true;
}

//===================================================

function GetXmlHttpObject()
{
var xmlHttp=null;
	try
 	{
 // Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 //Internet Explorer
 	try
  	{
  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  	}
 	catch (e)
  	{
  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
 }
return xmlHttp;
}

//===================================================

