$(document).ready(function() {
						   
// Here we will write a function when link click under class popup				   
$('a.popup').click(function() {
									
									
// Here we will describe a variable popupid which gets the
// rel attribute from the clicked link							
var popupid = $(this).attr('rel');


// Now we need to popup the marked which belongs to the rel attribute
// Suppose the rel attribute of click link is popuprel then here in below code
// #popuprel will fadein
$('#' + popupid).fadeIn();


// append div with id fade into the bottom of body tag
// and we allready styled it in our step 2 : CSS
$('body').append('<div id="fade"></div>');
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();


// Now here we need to have our popup box in center of 
// webpage when its fadein. so we add 10px to height and width 
var popuptopmargin = ($('#' + popupid).height() + 10) / 2;
var popupleftmargin = ($('#' + popupid).width() + 10) / 2;


// Then using .css function style our popup box for center allignment
$('#' + popupid).css({
'margin-top' : -popuptopmargin,
'margin-left' : -popupleftmargin
});
});
$('.close').click(function() {


// Add markup ids of all custom popup box here 						  
$('#fade , #popuprel , #popuprel2 , #popuprel3').fadeOut()
return false;
});

// Now define one more function which is used to fadeout the 
// fade layer and popup window as soon as we click on fade layer
$('#fade').click(function() {


// Add markup ids of all custom popup box here 						  
$('#fade , #popuprel , #popuprel2 , #popuprel3').fadeOut()
return false;
});
});


// Email alert functions
function thanku()
{
document.getElementById('id2').innerHTML="<font color=red><b>Thanks for your interest.At any point of time you may unsubscribe from our mailing list by opting out the option provided below the email. At PFG Money we respect your privacy. PFG Money will not provide access to your personal details to any other third parties *.</b></font><br>* This includes the right to send promotional materials of all other products of PFG Money and our affiliate companies.<br>" ;
}
function validate_email(x)
{
	if(x.name.value=='')
	{
	document.getElementById('e1').innerHTML="<font color=red><b>Name :</b></font>";
 	x.name.focus();
 	return false;
	}
	else
	{
		if(isAlphabetic(x.name.value))
		{
		document.getElementById('id2').innerHTML="";	
		document.getElementById('e1').innerHTML="Name :";
		}
	else
	{
		document.getElementById('id2').innerHTML="<font color=red><b>Enter Only Alphabets in Name Field</b></font>";
		document.getElementById('e1').innerHTML="<font color=red><b>Name :</b></font>";
		x.name.focus();
		return false;
	}
	}
	if(x.email.value=="")
	{
	document.getElementById('e2').innerHTML="<font color=red><b>E-Mail :</b></font>";
	x.email.focus();	
	return false;
	}
	else
	{
	if(emailValidator2(document.getElementById('email'),'Not a valid email address'))
			{
				document.getElementById('id2').innerHTML="";
				document.getElementById('e2').innerHTML="<font>E-Mail :</font>";
				
			}
		else
			{
				document.getElementById('id2').innerHTML="<font color=red><b>Invalid E Mail</b></font>";
			document.getElementById('e2').innerHTML="<font color=red><b>E-Mail :</b></font>";
			return false;
			}
	}
	
}//function close
	function emailValidator2(elem, helperMsg)
{
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp))
	{
		return true;
	}
	else
	{
		document.getElementById('id2').innerHTML="<font color=red><b>Invalid E Mail</b></font>";
		//alert(helperMsg);
		elem.focus();
		return false;
	}
}


// sms alert function 
function thanku_sms()
{
document.getElementById('id3').innerHTML="<font color=red><b>Thanks for your interest. At PFG Money we respect your privacy. PFG Money will not provide access to your personal details to any other third parties*.</b></font><br>* This includes the right to send promotional materials of all other products of PFG Money and our affiliate companies. <br><br>" ;
}
function validate_sms(x)
{

	if(x.name.value=='')
	{
	document.getElementById('e3').innerHTML="<font color=red><b>Name :</b></font>";
 	x.name.focus();
 	return false;
	}
	else
	{
		if(isAlphabetic(x.name.value))
		{
			document.getElementById('id3').innerHTML="";
		document.getElementById('e3').innerHTML="Name :";
		}
		else
	{
		document.getElementById('id3').innerHTML="<font color=red><b>Enter Only Alphabets in Name Field</b></font>";
		document.getElementById('e3').innerHTML="<font color=red><b>Name :</b></font>";
		x.name.focus();
		return false;
	}
		}
if(x.mob.value=='')
	{
	document.getElementById('e4').innerHTML="<font color=red><b>Mobile Number :</b></font>";
 	x.mob.focus();
 	return false;
	}
	else
	{
	document.getElementById('e4').innerHTML="Mobile Number :";
	}	
	
}//function close

																//for enter numbers only
function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
/* -------------------------------- Character validation -----------------*/
function isAlphabetic(val)
{
	if (val.match(/^[a-zA-Z][a-zA-Z ]+$/))
	{
//	alert("match");
	return true;
	}
else
	{
//alert("not match");
	return false;
	} 
}

