j = jQuery.noConflict();

j('document').ready(function(){
	if(j('#VoteYes').length != 0 && j('#VoteNo').length != 0){
		Magazine.setPollResults();
	}
});


Magazine = {
voteAction: '/magazine/Vote',
pollResultsAction: '/magazine/PollResults',
enterCompetitionAction: '/magazine/EnterCompetition',
enterAmtCompetitionAction: '/magazine/EnterAmtCompetition',
sendMessageAction: '/magazine/SendMessage',
addNewsletterRecipientActioin:'/magazine/AddNewsletterRecipient',
submitSurveyAction:'/magazine/SubmitSurvey',
sendCommunityMessageAction:'/magazine/SendMessage',
sendContactMessageAction:'/magazine/SendContactMessage',
sendInsuranceMessageAction:'/magazine/SendContactMessage',
sendTravelMessageAction:'/magazine/SendContactMessage',
sendPropertyMessageAction:'/magazine/SendContactMessage',
sendPressMessageAction:'/magazine/SendContactMessage',
sendCareersMessageAction:'/magazine/SendCareersMessage',
magazineSubscriptionAction:'/magazine/MagazineSubscription',
sendPropertyAdvertiseMessageAction:'/magazine/SendPropertyAdvertiseMessage',
sendRetirementDetailAction:'/magazine/SendRetirementDetail',
submitDataCaptureDetailAction:'/magazine/EnterDataCaptureExhibition',
submitDataCaptureDetailActionExp:'/magazine/EnterDataCaptureExhibitionExp',
submitExhibitionAction :'/magazine/sendExhibitionDetail',
submitNewPropertyAction :'/magazine/AddNewPropertyHolding',
submitWinAnnualTripAction : '/magazine/WinAnnualTrip',
submitTravelCruiseOfferAction : '/magazine/SendTravelCruiseOffer' ,
redirectHash: [],
Redirect : function (redirectLocation,redirect){    this.redirectLocation = redirectLocation;  this.redirect = redirect},
checkText : function (objSel,msg){
	if(objSel.value.length == 0 ){
	  alert(msg);
	  objSel.focus();
	  return true;
	}
	return false;
},
checkCheckBox : function (objSel,msg){
	
	if(objSel.checked != true){
	  alert(msg);
	  objSel.focus();
	  return true;
	}
	return false;
},
checkDob : function (objSel,msg){
		var Today = new Date();
		//alert(Today.getDate());
		if(Today.getDate()==getDate(objSel.value).getDate() && Today.getMonth()==getDate(objSel.value).getMonth() && Today.getYear()==getDate(objSel.value).getYear()){
			alert(msg);
			
			return true;
		}else{
			return false;
		}
		
	},
checkEmail : function(objSel,msg){

var re = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

   if(objSel.value == "" || !objSel.value.match(re)){
	  alert(msg);
	  objSel.focus();
	  return true;
	}
	return false;
	

},
checkEmails : function(objSel,objConfirmSel ,msg, matcherr){
	
	var re = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
	
	   if(objSel.value == "" || !objSel.value.match(re)){
		  alert(msg);
		  objSel.focus();
		  return true;
		}		
	   if(objSel.value !=  objConfirmSel.value){
		  alert(matcherr);
		  objConfirmSel.focus();
		  return true;
		}
		return false;
		
	
},
checkEmailWrite : function(objSel,msg){

var re = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
if(objSel.value !=""){
   if(!objSel.value.match(re)){
	  alert(msg);
	  objSel.focus();
	  return true;
	}
	}
	return false;
	

},
checkCheckBox :function(objSel,msg){
	
	if(objSel.checked != true){
	  alert(msg);
	  objSel.focus();
	  return true;
	}
	return false;
},
checkSelect :function (objSel,objSel1,objSel2,objSel3,msg){
	if(objSel.checked == true || objSel1.checked== true || objSel2.checked==true || objSel3.checked==true ){
	  return false;
	}
	else {
	  alert(msg);
	  objSel.focus();
	  return true;
	}
},
checkSelectNew :function (objSel1,objSel2,objSel3,msg){
	if( objSel1.checked== true || objSel2.checked==true || objSel3.checked==true ){
	  return false;
	}
	else {
	  alert(msg);
	  objSel.focus();
	  return true;
	}
},
checkSelectLookingStatus :function (objSel1,objSel2,msg){
	if( objSel1.checked== true || objSel2.checked==true  ){
	  return false;
	}
	else {
	  alert(msg);
	  objSel.focus();
	  return true;
	}
},
checkDateSelect : function (objSel,msg){
	if(objSel.value == ""){
	  alert(msg);
	  objSel.focus();
	  return true;
	}
	return false;
},
checkDestination :function (objSel1,objSel2,objSel3,msg){
	if(objSel1.checked == true || objSel2.checked== true || objSel3.checked==true  ){
	  return false;
	}
	else {
	  alert(msg);
	  objSel1.focus();
	  return true;
	}
},
checkHolidays :function (objSel1,objSel2,objSel3,objSel4,objSel5,objSel6,objSel7,objSel8,objSel9,msg){
	if(objSel1.checked == true || objSel2.checked== true || objSel3.checked==true || objSel4.checked==true || objSel5.checked==true|| objSel6.checked==true|| objSel7.checked==true|| objSel8.checked==true|| objSel9.checked==true){
	  return false;
	}
	else {
	  alert(msg);
	  objSel1.focus();
	  return true;
	}
},
getRadioValue :function(objSel)
{
var checked=false ;
	for(i=0 ; i < objSel.length; i++){
		if(objSel[i].checked){ return objSel[i].value ;}
	}
	
	
}

,
checkRadioNew :function (objSel,msg,objSel1,msg1){
	var checked = false;
	for(i=0 ; i < objSel.length; i++){
		if(objSel[i].checked){ checked = true;
		  if(objSel[i].value=="Y"){
		  if(Magazine.checkDateSelect(objSel1,msg1))return true;
		  		  }
		 break;}
	}
	if(checked != true){
	  alert(msg);
	  objSel[0].focus();
	  return true;
	}
	return false;
},
checkRadio :function (objSel,msg){
	var checked = false;
	for(i=0 ; i < objSel.length; i++){
		if(objSel[i].checked){ checked = true; break;}
	}
	if(checked != true){
	  alert(msg);
	  objSel[0].focus();
	  return true;
	}
	return false;
},
sendContactMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazineContactMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazineContactMesssagefm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkEmail(document.MagazineContactMesssagefm.Email,"Please enter a valid email")) return false;
	if(Magazine.checkText(document.MagazineContactMesssagefm.Message,"Please enter your message")) return false;
	if(Magazine.checkText(document.MagazineContactMesssagefm.recaptcha_response_field,"Please type the two words")) return false;
	
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_contact_message"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendContactMessageAction,
		j('#MagazineContactMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_contact_message"].redirect){
				window.location = Magazine.redirectHash["send_contact_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
sendInsuranceMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazineInsuranceMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazineInsuranceMesssagefm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazineInsuranceMesssagefm.Telephone,"Please enter value for telephone")) return false;	
	if(Magazine.checkEmails(document.MagazineInsuranceMesssagefm.Email, document.MagazineInsuranceMesssagefm.ConfirmEmail, "Invalid Email", "confirmation email does not match")) return;
	if(Magazine.checkText(document.MagazineInsuranceMesssagefm.Message,"Please enter your message")) return false;
	//if(Magazine.checkText(document.MagazineContactMesssagefm.recaptcha_response_field,"Please type the two words")) return false;
		
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_contact_message"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendInsuranceMessageAction,
		j('#MagazineInsuranceMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_contact_message"].redirect){
				window.location = Magazine.redirectHash["send_contact_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
sendTravelMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazineTravelMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazineTravelMesssagefm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazineTravelMesssagefm.Telephone,"Please enter value for telephone")) return false;
	if(Magazine.checkEmails(document.MagazineTravelMesssagefm.Email, document.MagazineTravelMesssagefm.ConfirmEmail, "Invalid Email", "confirmation email does not match")) return;
	if(Magazine.checkText(document.MagazineTravelMesssagefm.Message,"Please enter your message")) return false;//if(Magazine.checkText(document.MagazineContactMesssagefm.recaptcha_response_field,"Please type the two words")) return false;
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_contact_message"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendTravelMessageAction,
		j('#MagazineTravelMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_contact_message"].redirect){
				window.location = Magazine.redirectHash["send_contact_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
sendPropertyMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazinePropertyMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazinePropertyMesssagefm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazinePropertyMesssagefm.Telephone,"Please enter value for telephone")) return false;	
	if(Magazine.checkEmails(document.MagazinePropertyMesssagefm.Email, document.MagazinePropertyMesssagefm.ConfirmEmail, "Invalid Email", "confirmation email does not match")) return;
	if(Magazine.checkText(document.MagazinePropertyMesssagefm.Message,"Please enter your message")) return false;
	//if(Magazine.checkText(document.MagazineContactMesssagefm.recaptcha_response_field,"Please type the two words")) return false;
	
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_contact_message"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendPropertyMessageAction,
		j('#MagazinePropertyMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_contact_message"].redirect){
				window.location = Magazine.redirectHash["send_contact_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
sendPressMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazinePressMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazinePressMesssagefm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazinePressMesssagefm.Telephone,"Please enter value for telephone")) return false;	
	if(Magazine.checkEmails(document.MagazinePressMesssagefm.Email, document.MagazinePressMesssagefm.ConfirmEmail, "Invalid Email", "confirmation email does not match")) return;
	if(Magazine.checkText(document.MagazinePressMesssagefm.Message,"Please enter your message")) return false;
	//if(Magazine.checkText(document.MagazinePressMesssagefm.recaptcha_response_field,"Please type the two words")) return false;
	
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_contact_message"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendPressMessageAction,
		j('#MagazinePressMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_contact_message"].redirect){
				window.location = Magazine.redirectHash["send_contact_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
sendPropertyAdvertiseMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazinePropertyAdvertisefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazinePropertyAdvertisefm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazinePropertyAdvertisefm.Telephone,"Please enter value for telephone")) return false;
	if(Magazine.checkEmails(document.MagazinePropertyAdvertisefm.Email, document.MagazinePropertyAdvertisefm.ConfirmEmail, "Invalid Email", "confirmation email does not match")) return;
	if(Magazine.checkText(document.MagazinePropertyAdvertisefm.Message,"Please enter your message")) return false;//if(Magazine.checkText(document.MagazineContactMesssagefm.recaptcha_response_field,"Please type the two words")) return false;
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["sendPropertyAdvertiseMessage"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendPropertyAdvertiseMessageAction,
		j('#MagazinePropertyAdvertisefm').serialize() + '&Domain=' + window.location.host,
		function($data){			
			if(Magazine.redirectHash["sendPropertyAdvertiseMessage"].redirect){
				window.location = Magazine.redirectHash["sendPropertyAdvertiseMessage"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
sendCareersMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazineCareersMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkEmail(document.MagazineCareersMesssagefm.Email,"Please enter a valid email")) return false;
	if(Magazine.checkText(document.MagazineCareersMesssagefm.Telephone,"Please enter a valid telephone")) return false;
	if(Magazine.checkText(document.MagazineCareersMesssagefm.TimeSlot,"Please enter a valid time slot")) return false;
	if(Magazine.checkText(document.MagazineCareersMesssagefm.POS,"Please enter a valid position of interest")) return false;
	
	if(Magazine.checkText(document.MagazineCareersMesssagefm.Message,"Please enter your message")) return false;
	//if(Magazine.checkText(document.MagazineCareersMesssagefm.recaptcha_response_field,"Please type the two words")) return false;
	
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_careers_message"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendCareersMessageAction,
		j('#MagazineCareersMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				//Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_careers_message"].redirect){
				window.location = Magazine.redirectHash["send_careers_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
sendCommunityMessage: function(redirectLocation,redirect){
	if(Magazine.checkText(document.CommunityMesssagefm.FirstName,"Please enter your name")) return false;
	if(Magazine.checkEmail(document.CommunityMesssagefm.Email,"Please enter a valid email")) return false;
	if(Magazine.checkText(document.CommunityMesssagefm.Message,"Please enter your message")) return false;
	
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	j('body').css('cursor', 'wait');
	Magazine.redirectHash["send_community_message"] = new Magazine.Redirect(redirectLocation,redirect);
	j.post(
		Magazine.sendCommunityMessageAction,
		j('#CommunityMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if(Magazine.redirectHash["send_community_message"].redirect){
				window.location = Magazine.redirectHash["send_community_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
addNewsletterRecipient: function(redirectLocation,redirect){
	if(Magazine.checkEmail(document.AddNewsletterRecipientfm.Email,"Please enter a valid email")) return false;
	j('body').css('cursor', 'wait');
	Magazine.redirectHash["add_newsletter_recipient"] = new Magazine.Redirect(redirectLocation,redirect);
	j.post(
		Magazine.addNewsletterRecipientActioin,
		j('#AddNewsletterRecipientfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if(Magazine.redirectHash["add_newsletter_recipient"].redirect){
				window.location = Magazine.redirectHash["add_newsletter_recipient"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
submitSurvey: function(redirectLocation,redirect){

	
	if(Magazine.checkRadio(document.Survayfm.Gender,"Please select a value for gender")) return false;
	if(Magazine.checkRadio(document.Survayfm.AgeGroup,"Please select a value for age group")) return false;
	if(Magazine.checkRadio(document.Survayfm.PublishMagazine,"Please publish magazine")) return false;
	if(Magazine.checkText(document.Survayfm.BestPart,"Please enter value for best part")) return false;
	if(document.Survayfm.NotLikePart.value == '') if(Magazine.checkCheckBox(document.Survayfm.NotLikeCheck,"Please enter value for not liked part or check the check box to confirm")) return false;
	if(document.Survayfm.IncludeExtra.value == '') if(Magazine.checkCheckBox(document.Survayfm.IncludeExtraCheck,"Please enter value for extra include or check the check box to confirm")) return false;
		
	if(Magazine.checkRadio(document.Survayfm.Informative,"Please select a value for informativeness")) return false;
	if(Magazine.checkRadio(document.Survayfm.FutureProduct,"Please select one or more future products")) return false;
	if(Magazine.checkRadio(document.Survayfm.LifeInsurance,"Please select a value for life insurance")) return false;
	if(Magazine.checkRadio(document.Survayfm.PetInsurance,"Please select a value for pet insurance")) return false;
    if(Magazine.checkEmail(document.Survayfm.Email,"Please enter value for email")) return false;

    j('body').css('cursor', 'wait');
	
	Magazine.redirectHash["submit_survey"] = new Magazine.Redirect(redirectLocation,redirect);
	
	j.post(
		Magazine.submitSurveyAction,
		j('#Survayfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if(Magazine.redirectHash["submit_survey"].redirect){
				window.location = Magazine.redirectHash["submit_survey"].redirectLocation;
			}
		},
		'json'
	);
	return true;
	
},

sendMessage: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazineMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkEmail(document.MagazineMesssagefm.Email,"Please enter a valid email")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.Telephone,"Please enter value for telephone")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.Message,"Please enter your message")) return false;
	
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_message"] = new Magazine.Redirect(redirectLocation,redirect);
	j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendMessageAction,
		j('#MagazineMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if(Magazine.redirectHash["send_message"].redirect){
				window.location = Magazine.redirectHash["send_message"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
RedirectObject : function(redirectLocation,redirect){
	this.redirectLocation = redirectLocation;
	this.redirect = redirect;
},
enterCompetition: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazineCompetitionfm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazineCompetitionfm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkEmail(document.MagazineCompetitionfm.Email,"Please enter a valid email")) return false;
	if(Magazine.checkText(document.MagazineCompetitionfm.Telephone,"Please enter value for telephone")) return false;
	if(Magazine.checkText(document.MagazineCompetitionfm.Moniker,"Please enter value for moniker")) return false;
	if(Magazine.checkText(document.MagazineCompetitionfm.WhyChoose,"Please enter value for why choose moniker")) return false;
	if(Magazine.checkCheckBox(document.MagazineCompetitionfm.Conditions,"Please check the accept coditions box")) return false;
	

	//var val = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["enter_Competition"] = new Magazine.Redirect(redirectLocation,redirect);
	//alert(val.redirectLocation);
	j('body').css('cursor', 'wait');
	j.post(
		Magazine.enterCompetitionAction,
		j('#MagazineCompetitionfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if(Magazine.redirectHash["enter_Competition"].redirect){
				window.location = Magazine.redirectHash["enter_Competition"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
enterAmtCompetition: function(redirectLocation,redirect) {
	if(Magazine.checkRadio(document.MagazineAmtCompetitionfm.rdAgeGroup,"Please enter value for age group")) return false;
	if(Magazine.checkText(document.MagazineAmtCompetitionfm.txtName,"Please enter value for name")) return false;
	if(Magazine.checkEmail(document.MagazineAmtCompetitionfm.txtEmail,"Please enter a valid email")) return false;
	if(Magazine.checkText(document.MagazineAmtCompetitionfm.txtTelephone,"Please enter value for telephone")) return false;
	if(Magazine.checkText(document.MagazineAmtCompetitionfm.txtAddress1,"Please enter value address line 1")) return false;
	if(Magazine.checkText(document.MagazineAmtCompetitionfm.txtCity,"Please enter value for city")) return false;
	if(Magazine.checkText(document.MagazineAmtCompetitionfm.txtCountry,"Please enter value for country")) return false;
	if(Magazine.checkText(document.MagazineAmtCompetitionfm.txtDob,"Please enter value for date of birth")) return false;
	if(Magazine.checkText(document.MagazineAmtCompetitionfm.txtNationality,"Please enter value for nationality")) return false;
	if(Magazine.checkRadio(document.MagazineAmtCompetitionfm.rdResident,"Please enter value for resident type")) return false;
	
	

	//var val = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["enter_Amt_Competition"] = new Magazine.Redirect(redirectLocation,redirect);
	//alert(val.redirectLocation);
	j('body').css('cursor', 'wait');
	j.post(
		Magazine.enterAmtCompetitionAction,
		j('#MagazineAmtCompetitionfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if(Magazine.redirectHash["enter_Amt_Competition"].redirect){
				window.location = Magazine.redirectHash["enter_Amt_Competition"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
setPollResults: function (id){
	holder = j('#' + id);
	questionId = holder.attr('question');
	j.post(
		Magazine.pollResultsAction + '?questionId=' + questionId,
		'',
		function($data){
			
			if( $data.results.length > 0){
				$allVotes = 0;
				j.each($data.results, function($i, $item){
					$allVotes += $item.voteCount;
				});
				j.each($data.results, function($i, $item){
					j('#' + $item.voteType.substring(10)).html( parseInt(($item.voteCount / $allVotes) * 100) + '%');	
				});
			}
			
		},
		'json'
	);
	
},
magazineSubscribe: function(redirectLocation,redirect) {
	if(document.MagazineMesssagefm.TitleOther.value == ""){
		if(Magazine.checkText(document.MagazineMesssagefm.Title,"Please enter value for title")) return false;
	}
	if(Magazine.checkText(document.MagazineMesssagefm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.Surname,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.HomeTelephone,"Please enter a home telephone")) return false;
	if(Magazine.checkEmail(document.MagazineMesssagefm.Email,"Please enter your email")) return false;
	if(Magazine.checkEmail(document.MagazineMesssagefm.EmailConfirm,"Please enter value for confirm email")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.PostCode,"Please enter a valid post code")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.Address1,"Please enter value for address line 1")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.Town,"Please enter your town")) return false;
	if(Magazine.checkText(document.MagazineMesssagefm.County,"Please enter value for county")) return false;
	
	//Magazine.redirectHash['sendMessageRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["magazine_subscribe"] = new Magazine.Redirect(redirectLocation,redirect);
	j.post(
		Magazine.magazineSubscriptionAction,
		j('#MagazineMesssagefm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if(Magazine.redirectHash["magazine_subscribe"].redirect){
				window.location = Magazine.redirectHash["magazine_subscribe"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},
submitExhibition :function(redirectLocation,redirect){
	//j.getJSON(
	//	Magazine.submitExhibitionAction,
	//	function(data){
		//if(data.success==false)
	//	alert (data.success+"data.success");
							
				
					
				
					
						
	//});	
	
	if(Magazine.checkText(document.Exhibitionfm.appTitle, "Select a title of the applicant")) return false;
	if("Other" == document.Exhibitionfm.appTitle.value){
		if(Magazine.checkText(document.Exhibitionfm.appOtherTitle, "Select a title of the applicant")) return false;	
	}	
	if(Magazine.checkText(document.Exhibitionfm.FirstName, "Please fill the first name field")) return false;
	if(Magazine.checkText(document.Exhibitionfm.LastName, "Please fill the last name field")) return false;
	if(Magazine.checkText(document.Exhibitionfm.appPostCode, "Please fill the post code field")) return false;
	if(Magazine.checkText(document.Exhibitionfm.appAddress1, "Please fill the address field")) return false;
	if(Magazine.checkText(document.Exhibitionfm.appCity, "Please fill the city field")) return false;
	if(Magazine.checkText(document.Exhibitionfm.appCounty, "Please fill the county field")) return false;
	
    if(Magazine.checkEmails(document.Exhibitionfm.Email,document.Exhibitionfm.conEmail,"Please enter a valid email","confirmation email does not match")) return false;
    if(Magazine.checkText(document.Exhibitionfm.SelHowHear, "Please select how you know about Staysure")) return false;
	
	Magazine.redirectHash["submit_Exhibition"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.submitExhibitionAction,
		j('#Exhibitionfm').serialize() + '&Domain=' + window.location.host,
		function($data){
		//alert($data.success)
		if($data.success =="false"){
		alert("you already entered data");
		//redirect='false';
				return;
				}
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["submit_Exhibition"].redirect){
				window.location = Magazine.redirectHash["submit_Exhibition"].redirectLocation;
				
			}
			
		},
		'json'
	);
	return true;
},

submitAnnualTripInfo :function(redirectLocation,redirect){
	if(Magazine.checkRadio(document.AnnualTripInfofm.appQuestion, "Please select answer for the Question")) return false;
	if(Magazine.checkText(document.AnnualTripInfofm.appTitle, "Please fill the title field")) return false;
	//if("Other" == document.Exhibitionfm.appTitle.value){
	//	if(Magazine.checkText(document.Exhibitionfm.appOtherTitle, "Select a title of the applicant")) return false;	
	//}	
	if(Magazine.checkText(document.AnnualTripInfofm.FirstName, "Please fill the first name field")) return false;
	if(Magazine.checkText(document.AnnualTripInfofm.LastName, "Please fill the surname field")) return false;
	if(Magazine.checkText(document.AnnualTripInfofm.appAddress1, "Please fill the address field")) return false;
	if(Magazine.checkText(document.AnnualTripInfofm.appCity, "Please fill the city field")) return false;
	if(Magazine.checkText(document.AnnualTripInfofm.appCounty, "Please fill the county field")) return false;	
	if(Magazine.checkText(document.AnnualTripInfofm.appPostCode, "Please fill the post code field")) return false;
	if(Magazine.checkEmailWrite(document.AnnualTripInfofm.Email,"Please enter a valid email")) return false;
	if(Magazine.checkEmails(document.AnnualTripInfofm.Email,document.AnnualTripInfofm.conEmail,"Please enter a valid email","confirmation email does not match")) return false;
	if(Magazine.checkText(document.AnnualTripInfofm.Telephone, "Please fill the Telephone field")) return false;
	if(Magazine.checkText(document.AnnualTripInfofm.appDob, "Please fill the D.O.B. field")) return false;
	
    
   
	Magazine.redirectHash["submit_AnnualTrip"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.submitWinAnnualTripAction,
		j('#AnnualTripInfofm').serialize() + '&Domain=' + window.location.host,
		function($data){
		//alert($data.success)
		if($data.success =="false"){
		alert("you already entered data");
		//redirect='false';
				return;
				}
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["submit_AnnualTrip"].redirect){
				window.location = Magazine.redirectHash["submit_AnnualTrip"].redirectLocation;
				
			}
			
		},
		'json'
	);
	return true;
},



sendRetirementDetail: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.Title,"Please enter value for Title")) return false;
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.HomeTelephone,"Please enter value for home telephone")) return false;	
	if(Magazine.checkEmail(document.MagazinesendRetirementDetailfm.Email,"Please enter a valid email")) return false;
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.Address,"Please enter your address")) return false;
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.PostCode,"Please enter the post code")) return false;
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.City,"Please enter a value for city field")) return false;
	if(Magazine.checkText(document.MagazinesendRetirementDetailfm.Country,"Please enter a value for county field code")) return false;
	if(Magazine.checkSelect(document.MagazinesendRetirementDetailfm.PlanType,document.MagazinesendRetirementDetailfm.PlanType1,document.MagazinesendRetirementDetailfm.PlanType2,document.MagazinesendRetirementDetailfm.PlanType3,"Please check relevenat all retirement types")) return false;
	 if(Magazine.checkText(document.MagazinesendRetirementDetailfm.UK,"Please enter value for UK field")) return false;
	 if(Magazine.checkText(document.MagazinesendRetirementDetailfm.Abroad,"Please enter value for Abroad field")) return false;
	    
	//Magazine.redirectHash['sendRetirementDetailRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_Retirement_Detail"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.sendRetirementDetailAction,
		j('#MagazinesendRetirementDetailfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_Retirement_Detail"].redirect){
				window.location = Magazine.redirectHash["send_Retirement_Detail"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},



sendNewPropertyDetail: function(redirectLocation,redirect) {
	if(Magazine.checkText(document.MagazinesendNewPropertyDetailfm.Title,"Please select the Title")) return false;
	//if(Magazine.checkText(document.MagazinesendNewPropertyDetailfm.FirstName,"Please enter value for first name")) return false;
	if(Magazine.checkText(document.MagazinesendNewPropertyDetailfm.LastName,"Please enter value for last name")) return false;
	if(Magazine.checkText(document.MagazinesendNewPropertyDetailfm.HomeTelephone,"Please enter value for home telephone")) return false;	
	if(Magazine.checkEmailWrite(document.MagazinesendNewPropertyDetailfm.Email,"Please enter a valid email")) return false;
	//if(Magazine.checkText(document.MagazinesendRetirementDetailfm.Address1,"Please enter your address")) return false;
	//if(Magazine.checkText(document.MagazinesendNewPropertyDetailfm.PostCode,"Please enter the post code")) return false;
	//if(Magazine.checkText(document.MagazinesendNewPropertyDetailfm.City,"Please enter a value for city field")) return false;
	//if(Magazine.checkText(document.MagazinesendNewPropertyDetailfm.Country,"Please enter a value for county field code")) return false;
	//if(Magazine.checkSelectNew(document.MagazinesendNewPropertyDetailfm.PlanType1,document.MagazinesendNewPropertyDetailfm.PlanType2,document.MagazinesendNewPropertyDetailfm.PlanType3,"Please check relevent all retirement types")) return false;
	// if(Magazine.checkSelectLookingStatus(document.MagazinesendNewPropertyDetailfm.BuyStatus,document.MagazinesendNewPropertyDetailfm.LetStatus,"Please select what are you looking to")) return false;
	
	    
	//Magazine.redirectHash['sendRetirementDetailRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	Magazine.redirectHash["send_NewProperty_Detail"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.submitNewPropertyAction,
		j('#MagazinesendNewPropertyDetailfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["send_NewProperty_Detail"].redirect){
				window.location = Magazine.redirectHash["send_NewProperty_Detail"].redirectLocation;
			}
		},
		'json'
	);
	return true;
},




sendTravelCruiseOfferInfo: function() {
	if(Magazine.checkText(document.MagazineTravelCruiseOfferInfofm.Title,"Please select the Title")) return false;
	if(Magazine.checkText(document.MagazineTravelCruiseOfferInfofm.FirstName,"Please enter your first name")) return false;
	if(Magazine.checkText(document.MagazineTravelCruiseOfferInfofm.LastName,"Please enter your last field")) return false;
	if(Magazine.checkText(document.MagazineTravelCruiseOfferInfofm.Telephone,"Please enter the telephone number")) return false;
	if(Magazine.checkText(document.MagazineTravelCruiseOfferInfofm.Mobile,"Please enter the mobile number")) return false;		
	if(Magazine.checkEmail(document.MagazineTravelCruiseOfferInfofm.Email,"Please enter a valid email address")) return false;
	if(Magazine.checkEmails(document.MagazineTravelCruiseOfferInfofm.Email,document.MagazineTravelCruiseOfferInfofm.EmailConfirm,"Please enter a valid email address","Please re-enter email address in confirm email field")) return false;
	
	
	    
	//Magazine.redirectHash['sendRetirementDetailRedirect'] = new Magazine.RedirectObject(redirectLocation,redirect);
	//Magazine.redirectHash["send_TravelCruiseOffer_Detail"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.submitTravelCruiseOfferAction,
		j('#MagazineTravelCruiseOfferInfofm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				Recaptcha.reload ();
				alert($data.message+". Please try again.");
				return;
			}
			
			if($data.success == "true"){
				j('#Curtain').show(); 
				j('#v2MessageWrapper').hide(); 
				j('#v2MessageWrapper_2').show();
			}
		},
		'json'
	);
	return true;
},












submitDataCaptureDetail:function(redirectLocation,redirect){
	
	if(Magazine.checkText(document.DataCaptureDetailfm.employee, " Please select the employee name")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appTitle, "Select a title of the applicant")) return false;
	if("Other" == document.DataCaptureDetailfm.appTitle.value){
		if(Magazine.checkText(document.DataCaptureDetailfm.appOtherTitle, "Select a title of the applicant")) return false;	
	}	
	if(Magazine.checkText(document.DataCaptureDetailfm.FirstName, "Please fill the first name field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.LastName, "Please fill the last name field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appPostCode, "Please fill the post code field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appAddress1, "Please fill the address field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appCity, "Please fill the city field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appCounty, "Please fill the county field")) return false;
	//if(document.getElementById("appCountry") != null)
		//if(Magazine.checkText(document.DataCaptureDetailfm.appCountry, "Fill the country field")) return;
	//if(Magazine.checkText(document.DataCaptureDetailfm.Telephone, "Please fill the telephone field")) return false;
    if(Magazine.checkEmailWrite(document.DataCaptureDetailfm.Email,"Please enter a valid email")) return false;
    if(Magazine.checkDob(document.DataCaptureDetailfm.appDob,"Please select valid birth day ")) return false;
	if(Magazine.checkCheckBox(document.DataCaptureDetailfm.agreeStatus,"You need to agree")) return false;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.awareFastest, "Please select answer for each question")) return false;
	if(Magazine.checkHolidays(document.DataCaptureDetailfm.holType1,document.DataCaptureDetailfm.holType2,document.DataCaptureDetailfm.holType3,
	document.DataCaptureDetailfm.holType4,document.DataCaptureDetailfm.holType5,document.DataCaptureDetailfm.holType6,
	document.DataCaptureDetailfm.holType7,document.DataCaptureDetailfm.holType8,document.DataCaptureDetailfm.holType9,
	"Please check relevant all holidays types")) return false;
	if(Magazine.checkDestination(document.DataCaptureDetailfm.desType1,document.DataCaptureDetailfm.desType2,document.DataCaptureDetailfm.desType3,"Please check relevent all destination types")) return false;	
	if(Magazine.checkRadio(document.DataCaptureDetailfm.amountType1,"Please select approximate amount")) return false;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.awareStatus, "Please select answer for each question")) return false;
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.expertSupport, "Please select answer for each question")) return false;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.travType1, "Please select whether you purchase a Single trip")) return false;
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.travType2, "Select whether you purchase a Annual trip")) return false;
	//if("Y" == document.DataCaptureDetailfm.travType2.value){ 
	   if(Magazine.checkRadioNew(document.DataCaptureDetailfm.travType2,"Please select whether you purchase an Annual trip",document.DataCaptureDetailfm.renewDate, "Please select the AMT renewal month")) return;
	//}
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.buyingStaysure, "Please select answer for each question ")) return;
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.coverType1,"Please select whether you purchase a Home Insurance",document.DataCaptureDetailfm.renewDate1, "Please select the Home Insurance renewal month")) return;
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.coverType1, "Please select answer for each question")) return;
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.coverType2,"Please select whether you purchase a Car Insurance",document.DataCaptureDetailfm.renewDate2, "Please select the Car Insurance renewal month")) return;
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.coverType2, "Please select answer for each question")) return;
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.coverType3,"Please select whether you purchase a Medical Insurance",document.DataCaptureDetailfm.renewDate3, "Please select the Medical Insurance renewal month")) return;
	//if('N' == j('coverType3').val())
	if('N' == Magazine.getRadioValue(document.DataCaptureDetailfm.coverType3))
		if(Magazine.checkRadio(document.DataCaptureDetailfm.noObligationMedical,"Please select whether you need a no obligation medical insurance quote")) return;
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.coverType4,"Please select whether you purchase a Life Insurance",document.DataCaptureDetailfm.renewDate4, "Please select the Life Insurance renewal month")) return;
	if('N' == Magazine.getRadioValue(document.DataCaptureDetailfm.coverType4))
		if(Magazine.checkRadio(document.DataCaptureDetailfm.noObligationLife,"Please select whether you need a no obligation life insurance quote")) return;
				
		
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.coverType3, "Please select answer for each question")) return;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.contactType, "Please select which contact type you prefer")) return;
	
	Magazine.redirectHash["submit_DataCapture_Detail"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.submitDataCaptureDetailAction,
		j('#DataCaptureDetailfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["submit_DataCapture_Detail"].redirect){
				window.location = Magazine.redirectHash["submit_DataCapture_Detail"].redirectLocation;
				
			}
			document.DataCaptureDetailfm.reset(); 
		},
		'json'
	);
	return true;
},
submitExpatDataCaptureDetail:function(redirectLocation,redirect){
	
	if(Magazine.checkText(document.DataCaptureDetailfm.employee, " Please select the employee name")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appTitle, "Select a title of the applicant")) return false;
	if("Other" == document.DataCaptureDetailfm.appTitle.value){
		if(Magazine.checkText(document.DataCaptureDetailfm.appOtherTitle, "Select a title of the applicant")) return false;	
	}	
	if(Magazine.checkText(document.DataCaptureDetailfm.FirstName, "Please fill the first name field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.LastName, "Please fill the last name field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appPostCode, "Please fill the post code field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appAddress1, "Please fill the address field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appCity, "Please fill the city field")) return false;
	if(Magazine.checkText(document.DataCaptureDetailfm.appCounty, "Please fill the county field")) return false;
	//if(document.getElementById("appCountry") != null)
		//if(Magazine.checkText(document.DataCaptureDetailfm.appCountry, "Fill the country field")) return;
	//if(Magazine.checkText(document.DataCaptureDetailfm.Telephone, "Please fill the telephone field")) return false;
    if(Magazine.checkEmailWrite(document.DataCaptureDetailfm.Email,"Please enter a valid email")) return false;
    if(Magazine.checkDob(document.DataCaptureDetailfm.appDob,"Please select valid birth day ")) return false;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.agreeStatus,"State whether You agree or not")) return false;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.awareStatusStaysure, "Please select answer for each question")) return false;
	
	
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.awareStatusHomeInsurance,"Please select whether you purchase a Home Insurance",document.DataCaptureDetailfm.homeRenewalDate, "Please select the Home Insurance renewal month")) return;
	
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.awareStatusMotorInsurance,"Please select whether you purchase a Car Insurance",document.DataCaptureDetailfm.motorRenewalDate, "Please select the Car Insurance renewal month")) return;
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.coverType2, "Please select answer for each question")) return;
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.awareStatusMedicalInsurance,"Please select whether you purchase a Medical Insurance",document.DataCaptureDetailfm.medicalRenewalDate, "Please select the Medical Insurance renewal month")) return;
	//if('N' == j('coverType3').val())
	if('N' == Magazine.getRadioValue(document.DataCaptureDetailfm.awareStatusMedicalInsurance))
		if(Magazine.checkRadio(document.DataCaptureDetailfm.noObligationMedical,"Please select whether you need a no obligation medical insurance quote")) return;
	if(Magazine.checkRadioNew(document.DataCaptureDetailfm.awareStatusTravelInsurance,"Please select whether you purchase a Travel Insurance",document.DataCaptureDetailfm.travelRenewalDate, "Please select the Travel Insurance renewal month")) return;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.knowAboutFuneralPlan, "Please select answer for each question")) return false;
	if(Magazine.checkRadio(document.DataCaptureDetailfm.likeStatusToBookAppointment, "Please select answer for each question")) return false;
	if('Y' == Magazine.getRadioValue(document.DataCaptureDetailfm.likeStatusToBookAppointment)){
	   if(Magazine.checkText(document.DataCaptureDetailfm.productName, "Please Select  the product Name"))
	    return false;
	    if(Magazine.checkText(document.DataCaptureDetailfm.bookingDate, "Please Select  the booking Date")) return false;
	     if(Magazine.checkText(document.DataCaptureDetailfm.bookingTime, "Please Select  the booking Time")) return false;
	      if(Magazine.checkText(document.DataCaptureDetailfm.agentName, "Please Select  the agent Name"))
	      return false;
	}
	if(Magazine.checkRadio(document.DataCaptureDetailfm.newsLetter, "Please select answer for each question")) return false;
	
	
				
		
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.coverType3, "Please select answer for each question")) return;
	//if(Magazine.checkRadio(document.DataCaptureDetailfm.contactType, "Please select which contact type you prefer")) return;
	
	Magazine.redirectHash["submit_DataCapture_Detail"] = new Magazine.Redirect(redirectLocation,redirect);
	//j('body').css('cursor', 'wait');
	j.post(
		Magazine.submitDataCaptureDetailActionExp,
		j('#DataCaptureDetailfm').serialize() + '&Domain=' + window.location.host,
		function($data){
			if($data.success == "false" && $data.error == -2) {
				j('body').css('cursor', '');
				alert($data.message+". Please try again.");
				return;
			}
			if(Magazine.redirectHash["submit_DataCapture_Detail"].redirect){
				window.location = Magazine.redirectHash["submit_DataCapture_Detail"].redirectLocation;
				
			}
			document.DataCaptureDetailfm.reset(); 
		},
		'json'
	);
	return true;
},

addVote: function (redirectLocation,redirect,form){
	var questionID = j(form).attr('question');
	var value = j(form).find("input[name='voteType']:checked").val(); 
	if (value == null){
		alert('Please select an option');
		return false;		
	}
	j('body').css('cursor', 'wait');
	
	Magazine.redirectHash["add_vote"] = new Magazine.Redirect(redirectLocation,redirect);

	var data = "voteType="+value;
	data += "&domain="+window.location.host;
	data += "&companyId=0"
	data += "&groupId=0"
	data += "&languageId=0";
	data += "&userId=0";
	data += "&questionId=" + questionID;

	j.post(
		Magazine.voteAction,
		data,
		function($data){
			//ignore erros
			if(Magazine.redirectHash["add_vote"].redirect){
				window.location = Magazine.redirectHash["add_vote"].redirectLocation;//Magazine.voteResultsPath;
			}
		},
		'json'
	);
}
};


//var tt = new Magazine.Magazine("test",true);

//alert(tt.redirectLocation);
