// JavaScript Document

/*************** script for help box*************/
function showHelp(id){
	helpId = "helpText" + id.id;
	document.getElementById(helpId).style.display = "block";

}

function hideHelp(id){
	helpId = "helpText" + id.id;
	document.getElementById(helpId).style.display = "none";
	
}
function showHelpNew(id){
	helpId = "helpTextNew" + id.id;
	document.getElementById(helpId).style.display = "block";

}

function hideHelpNew(id){
	helpId = "helpTextNew" + id.id;
	document.getElementById(helpId).style.display = "none";
	
}

function clearText(obj) {
	//alert("document.personal_info.CheckContent.value"+document.personal_info.CheckContent.value);
	if(document.personal_info.CheckContent.value ==""){
		obj.value = "";
		obj.style.color ="#000000";
	}

	//adding logic to cleartext field for lualty Member Id
	 if(document.Bank_details.loylalmemberId.value != ""){
	 	obj.value = "";
		obj.style.color ="#000000";
	 }

}

function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}


	
function showother(val){
	
	if(val == 1){
	if(document.personal_info.City1.value == "Others"){
		document.getElementById("divOtherCity").style.display = "inline";
		//document.personal_info.stdcode.value="";
	}
	else{
		document.getElementById("divOtherCity").style.display = "none";
		}
	}
	if(val == 2){
	if(document.personal_info.City2.value == "Others"){
		document.getElementById("divOtherCity2").style.display = "inline";
		//document.personal_info.Perm_stdcode.value="";
	}
	else{
		document.getElementById("divOtherCity2").style.display = "none";
		}
	}
	/* if(val == 3){
	if(document.personal_info.off_location_city.value == "Others"){
		document.getElementById("divOtherCity3").style.display = "inline";
	}
	else{
		document.getElementById("divOtherCity3").style.display = "none";
		}
	}*/

}

function checkform(){
	
	if(document.personal_info.NameOnCard.value==""){
		document.personal_info.NameOnCard.style.border = "2px solid red";
		return false;
		}
	}

	

	function displayWatch(val)
{	
    if (val == "8500")
	{
	  	document.getElementById("divTwo1").style.display = "block";
		document.getElementById("giftText85").style.display = "block";
		document.getElementById("giftText12").style.display = "none";
		document.getElementById("divTwo11").style.display = "none";
		document.getElementById("common").style.display = "none";	
	}
	

	if(val == "12000")
	{
		document.getElementById("divTwo1").style.display = "none";
	  	document.getElementById("divTwo11").style.display = "block";	
		document.getElementById("giftText85").style.display = "none";
		document.getElementById("giftText12").style.display = "block";
		document.getElementById("common").style.display = "none";
	}
	if(val != "8500" && val != "12000"){
		document.getElementById("common").style.display = "block";
		document.getElementById("divTwo1").style.display = "none";
	  	document.getElementById("divTwo11").style.display = "none";	
		document.getElementById("giftText85").style.display = "none";
		document.getElementById("giftText12").style.display = "none";
	
	}
		
}


function openPopUp(url){

alert(url);

}


	function displayWatchLeague(cardName,goodiesAmount)

	{

	
		var leagueHtml = "<div class=\"contentItems\">";
		var nameHtml = "name=\"subgoody\"";

		var resultHtml = "";

		if(cardName=="league"){
			

			for(var p=0;p<leaguegoodyArray.length;p++){

				if(leaguegoodyArray[p][0] ==goodiesAmount ){

								if(leaguegoodyArray[p].length>1){
				
								
									for(var k=1;k<leaguegoodyArray[p].length;k++){
																				
										leagueHtml+="<label><input type=\"radio\" id=\"leaguesubgoody\" name=\"subgoody\" " ;
										leagueHtml+="value=\"" + leaguegoodyArray[p][k] + "\" />";
										k++;
										leagueHtml+="<IMG SRC=\" /bpmapp-upload/download/"+leaguegoodyArray[p][k] +"\" onclick='openPopUp(\""+ leaguegoodyArray[p][++k]+"\")'  context=\"no\"/>";
										
										
										leagueHtml+="</label>";
										
										
										
											}

									}
									else
									{

										// else part
										leagueHtml+="<label class=\"radio\"><input type=\"hidden\" id=\"leaguesubgoody\" name=\"subgoody\" value=\"\" />";
										leagueHtml+="</label>";


									}
					leagueHtml+="</div>";
					resultHtml = leagueHtml;
					//alert("resultHtml"+resultHtml);
					break;

				}
			
			}



		
		}


		if(goodiesAmount.length>0)
		{
			
			document.getElementById("divTwo1").innerHTML="";
			document.getElementById("divTwo2").innerHTML="";
			document.getElementById("divTwo3").innerHTML="";
			document.getElementById("divTwo4").innerHTML="";


		document.getElementById("divTwo1").style.display = "none";
		document.getElementById("divTwo2").style.display = "none";
		document.getElementById("divTwo3").style.display = "none";
		document.getElementById("divTwo4").style.display = "none";
		document.getElementById("divTwo1").style.display = "block";
		document.getElementById("divTwo1").innerHTML= resultHtml;

		
		
		}

   }// end of displayWatchLeague



   function displayWatchFortune(cardName,goodiesAmount)

	{
		
	
		var leagueHtml = "<div class=\"contentItems\">";
		var nameHtml = "name=\"subgoody\"";

		var resultHtml = "";

		if(cardName=="fortune"){

			for(var p=0;p<fortunegoodyArray.length;p++){

				
				if(fortunegoodyArray[p][0] ==goodiesAmount ){
										
									if(fortunegoodyArray[p].length>1)
									{

								

										for(var k=1;k<fortunegoodyArray[p].length;k++){
											
											leagueHtml+="<label ><input type=\"radio\" id=\"fortunesubgoody\" name=\"subgoody\" ";
											leagueHtml+="value=\"" + fortunegoodyArray[p][k] + "\" />";
											k++;
											leagueHtml+="<IMG SRC=\" /bpmapp-upload/download/"+fortunegoodyArray[p][k] +"\" onclick='openPopUp(\""+ fortunegoodyArray[p][++k]+"\")'  context=\"no\"/>";
											
											//leagueHtml+= fortunegoodyArray[p][k];
											//leagueHtml+="</label>";

											//k++;
											//leagueHtml+="<IMG SRC=\" /bpmapp-upload/download/"+fortunegoodyArray[p][k] +"\" width=\"50\" height=\"50\" context=\"no\"/>";
											leagueHtml+="</label>";
											//leagueHtml+="<br>";
											

										}

									}
									else
									{

										// else part
										leagueHtml+="<label class=\"radio\"><input type=\"hidden\" id=\"fortunesubgoody\" name=\"subgoody\" value=\"\" />";
										leagueHtml+="</label>";


									}
					leagueHtml+="</div>";
					resultHtml = leagueHtml;
				
					break;
				}
			
			}



		
		}


		if(goodiesAmount.length>0)
		{

			document.getElementById("divTwo1").innerHTML="";
			document.getElementById("divTwo2").innerHTML="";
			document.getElementById("divTwo3").innerHTML="";
			document.getElementById("divTwo4").innerHTML="";

		
		document.getElementById("divTwo1").style.display = "none";
		document.getElementById("divTwo2").style.display = "none";
		document.getElementById("divTwo3").style.display = "none";
		document.getElementById("divTwo4").style.display = "none";
		document.getElementById("divTwo2").style.display = "block";
		document.getElementById("divTwo2").innerHTML= resultHtml;
		
		}

   }// end of displayWatchFortune



//var royaleSubGoodiesPresent;

function displayWatchRoyal(cardName,goodiesAmount)

	{
		
	
		var leagueHtml = "<div class=\"contentItems\">";
		var nameHtml = "name=\"subgoody\"";

		var resultHtml = "";

		if(cardName=="royale"){

			for(var p=0;p<royalegoodyArray.length;p++){

				
				if(royalegoodyArray[p][0] ==goodiesAmount ){
										
									if(royalegoodyArray[p].length>1)
									{

								

										for(var k=1;k<royalegoodyArray[p].length;k++){
											
											leagueHtml+="<label><input type=\"radio\" id=\"royalesubgoody\" name=\"subgoody\" ";
											leagueHtml+="value=\"" + royalegoodyArray[p][k] + "\" />";
											k++;
											leagueHtml+="<IMG SRC=\" /bpmapp-upload/download/"+royalegoodyArray[p][k] +"\" onclick='openPopUp(\""+ royalegoodyArray[p][++k]+"\")'  context=\"no\"/>";
											
											//leagueHtml+= royalegoodyArray[p][k];
											//leagueHtml+="</label>";
											//k++;
											//leagueHtml+="<IMG SRC=\" /bpmapp-upload/download/"+royalegoodyArray[p][k] +"\" width=\"50\" height=\"50\" context=\"no\"/>";
											leagueHtml+="</label>";
											//leagueHtml+="<br>";

										}

									}
									else
									{

										// else part
										leagueHtml+="<label class=\"radio\"><input type=\"hidden\" id=\"royalesubgoody\" name=\"subgoody\" value=\"\" />";
										leagueHtml+="</label>";


									}
					leagueHtml+="</div>";
					resultHtml = leagueHtml;
				
					break;
				}
			
			}



		
		}


		if(goodiesAmount.length>0)
		{
			

		document.getElementById("divTwo1").style.display = "none";
		document.getElementById("divTwo2").style.display = "none";
		document.getElementById("divTwo3").style.display = "none";
		document.getElementById("divTwo4").style.display = "none";
		document.getElementById("divTwo3").style.display = "block";
		document.getElementById("divTwo3").innerHTML="";
		document.getElementById("divTwo3").innerHTML= resultHtml;
		
	
	}	

   }

  // end of displayWatchRoyal

   


    function displayWatchTrump(cardName,goodiesAmount)

	{
		
		var leagueHtml = "<div class=\"contentItems\">";
		var nameHtml = "name=\"subgoody\"";

		var resultHtml = "";

		if(cardName=="trump"){

			for(var p=0;p<trumpgoodyArray.length;p++){

				
				if(trumpgoodyArray[p][0] ==goodiesAmount ){
				
								if(trumpgoodyArray[p].length>1)
									{
	//	alert("trumpgoodyArray[p].length"+trumpgoodyArray[p].length);
										for(var k=1;k<trumpgoodyArray[p].length;k++){
											
											leagueHtml+="<label><input type=\"radio\" id=\"trumpsubgoody\" name=\"subgoody\" ";
											leagueHtml+="value=\"" + trumpgoodyArray[p][k] + "\" />";
											k++;
											leagueHtml+="<IMG SRC=\" /bpmapp-upload/download/"+trumpgoodyArray[p][k] +"\" onclick='openPopUp(\""+ trumpgoodyArray[p][++k]+"\")' context=\"no\"/>";
											
											//leagueHtml+= trumpgoodyArray[p][k];
											//leagueHtml+="</label>";
											
											//k++;
											//leagueHtml+="<IMG SRC=\" /bpmapp-upload/download/"+trumpgoodyArray[p][k] +"\" width=\"50\" height=\"50\" context=\"no\"/>";
											leagueHtml+="</label>";
											//leagueHtml+="<br>";





										}



							}
							else
							{
							leagueHtml+="<label class=\"radio\"><input type=\"hidden\" id=\"trumpsubgoody\" name=\"subgoody\" value=\"\" />";
							leagueHtml+="</label>";
							}
					leagueHtml+="</div>";
				
					resultHtml = leagueHtml;
					break;
				}
			
			}



		
		}


		if(goodiesAmount.length>0)
		{

			document.getElementById("divTwo1").innerHTML="";
			document.getElementById("divTwo2").innerHTML="";
			document.getElementById("divTwo3").innerHTML="";
			document.getElementById("divTwo4").innerHTML="";

		document.getElementById("divTwo4").style.display = "none";
		document.getElementById("divTwo1").style.display = "none";
		document.getElementById("divTwo2").style.display = "none";
		document.getElementById("divTwo2").style.display = "none";
		document.getElementById("divTwo4").style.display = "block";
		document.getElementById("divTwo4").innerHTML= resultHtml;
		
		}
	//	alert("resultHtml"+resultHtml);
   }// end of displayWatchTrump

//function to open a popupWindow
function openPopUp(popupUrl){

window.open(popupUrl,"",'width=697,height=295,scrollbars=yes');

}

