function popup_ApplyNow_NV()
{

	var c_value = "";
	//alert(document.hl_apply_checkbox.apply_product.length);
	for (var i=0; i < document.hl_apply_checkbox.apply_product.length; i++)
	   {
	   if (hl_apply_checkbox.apply_product[i].checked)
		  {
		  c_value = c_value + hl_apply_checkbox.apply_product[i].value + ",";
		  }
	   }

	opener.document.getElementById('final_product_item_ids').value = c_value;
 	opener.document.getElementById('light').style.display='block';
	opener.document.getElementById('fade').style.display='block'
	window.close();
	//document.body.style.overflowY = 'hidden';
}


function validateLoginDetails(){
        if (trim(document.getElementById("username").value) =="")
        {
            alert("Login Field can not left blank");
            document.getElementById("username").focus();
            return false;
        }
        if (document.getElementById("new_password").value =="")
        {
            alert("Password Field can not left blank");
            document.getElementById("new_password").focus();
            return false;
        }
	return true;
}
//------------special characters not allowed-------------------------------
function specialCharValidation(getVal) 
{
	   var iChars = "!@#$%^&*()+=[]\\\;,./{}|\":<>?%";
	   for (var i = 0; i < getVal.length; i++)
	   {
		   if (iChars.indexOf(getVal.charAt(i)) != -1)
		   {
					return false;
		   }
		}        
		return true;
}
//--------------- Email validation ----------------//
//----------email format validation----------------//
function checkEmail(email) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
		return (true)
	}
	return (false)
}
//-------------------------------------------------//

//--------------- First Letter in Caps----------------------------------//
function initialCap(str) {
   str = str.substr(0, 1).toUpperCase() + str.substr(1);
   return str;
}
//-------------------------------------------------//

//--------------- Mobile and land line Number Validation -------------------------------//
function ValidateContact(contact_obj){
	
	var contact = trim(contact_obj.value);
	var first_char = contact.substr(0,1);
	var len = contact.length;
  
	if(contact=='') {
		alert("Please enter contact number.\nFor mobile, E.g., 9892xxxxxx.\nFor landline, E.g., 022xxxxxxxx");
		contact_obj.focus();
		return false;
	}
	if(IsNumeric(contact)==false) {
		alert("Please enter numeric value for contact number.\nFor mobile, E.g., 9892xxxxxx.\nFor landline, E.g., 022xxxxxxxx");
		contact_obj.focus();
		return false;
	}
	
	if(len == 10 || len == 11)
	{
		if(len ==10 && first_char!=8 && first_char!=9)
		{
			alert("Please enter a correct 10-digit contact number.\nStarting with 9 OR 8 \nE.g. 9892xxxxxx.");
			contact_obj.focus();
			return false;
		}
		else if(len ==11 && first_char!=0)
		{
			alert("Please enter a correct 11-digit contact number. \nE.g. 0226728xxxx.");
			contact_obj.focus();
			return false;
		}
		else if(contact == 9999999999 || contact == 8888888888 || contact == 9898989898 || contact == 9876543210 || contact == 1234567890)
		{
			alert("Please enter a Valid Contact Number");
			contact_obj.focus();
			return false;
		}
	}else{
			if(first_char==0){
				alert("Please enter a correct 11-digit contact number. \nE.g. 0226728xxxx.");
				contact_obj.focus();
				return false;
			}else if(first_char == 9 || first_char== 8){
				alert("Please enter a correct 10-digit contact number. \nE.g. 9892xxxxxx. OR 8080xxxxxx");
				contact_obj.focus();
				return false;
			}else{
				alert("Please enter a correct contact number.\nFor mobile, E.g., 9892xxxxxx.\nFor landline, E.g., 022xxxxxxxx");
				contact_obj.focus();
				return false;
			}
	}
	
}
//--------------------------------------------------------------------------------//

function validateSearchBox(){
       if (document.getElementById("query").value =="")
        {
            alert("Please enter search term.");
            document.getElementById("query").focus();
            return false;
        }
		if (specialCharValidation(document.getElementById("query").value)== false)
        {
            alert("Special charaters are not allowed.");
            document.getElementById("query").focus();
            return false;
        }
	return true;
}
//------------- quick apply validation --------------------//
function validateTalktome(theform){
    var formcontent = theform.txtcontact.value;
	var name= trim(theform.txtName.value);
	var contact = trim(theform.txtcontact.value);

	if(document.getElementById("DrpListproduct").value == 0)
	{
		alert("Please select the product.");
		document.getElementById("DrpListproduct").focus();
		return false;        
	}
	if(name =="" || name == "Name")
	{
		alert("Please enter your name.");
		document.getElementById("txtName").focus();
		return false;
	}
	if(specialCharValidation(document.getElementById("txtName").value)== false)
    {
            alert("Special charaters are not allowed.");
            document.getElementById("txtName").focus();
            return false;
    }
	if(document.getElementById("quick_city").selectedIndex == 0)
	{
		alert("Please select the city.");
		document.getElementById("quick_city").focus();
		return false;        
	}
    if (contact =="" || contact == "Mobile/Tel")
	{
		alert("Please enter your mobile No.");
		document.getElementById("txtcontact").focus();
		return false;
	}
	if(ValidateContact(theform.txtcontact)==false){
       return false;
	}
	var address = trim(document.getElementById("txtEmail").value);
	if(address=="" || address=="Email"){
	   alert('Please enter your Email.');
	   document.getElementById("txtEmail").focus();
	   return false;
	}
	if(checkEmail(address) == false)
	{
	   alert('Your email address seems incorrect. Please try again.');
	   document.getElementById("txtEmail").focus();
	   return false;
	}
	return true;
}
//-------------- Check for valid numeric strings ----------------------------//

function IsNumeric(strString)
{
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function show()
{
	document.getElementById("txtName").value = document.getElementById("txtContent").value;
}


function showPopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "block"
dlg.style.display = "block"
if (document.body.style.overflow == "hidden") {
cvr.style.width = "1300"
cvr.style.height = "100%"
}
//document.getElementById("pakav_username").focus();
document.getElementById("query").focus();

}

function showAppPopUp(el,flag) {
document.getElementById('query').focus();
//alert(flag);

if(flag != "no"){
	document.getElementById('term_of_policy').style.display = "none"
	document.getElementById('search_city').style.display = "none"

} else {
	//left_form
	document.getElementById('left_form').style.display = "none"
}
var cvr = document.getElementById("applicstion_cover")
var dlg = document.getElementById(el)
dlg.style.zIndex = 100;
cvr.style.zIndex = 100;
cvr.style.display = "block"
dlg.style.display = "block"
if (document.body.style.overflow == "hidden") {
cvr.style.width = "1300"
cvr.style.height = "100%"
}
//document.getElementById("pakav_username").focus();

}
function closePopUp(el,url) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "none"
dlg.style.display = "none"
//document.body.style.overflowY = "scroll"
window.location = url;
}

function closeAppPopUp(url) {
	window.location=url;

}

function validateSubmit_health(theForm,flag)
{
	
	if(flag == 'no')
		document.getElementById('applicstion_dialog').innerHTML = ""
	var radioSelected = false;
	if (trim(document.getElementById("firstname").value) =="")
	{
		alert("First name can not left blank");
		document.getElementById("firstname").focus();
		return false;
	}
	if (trim(document.getElementById("lastname").value) =="")
	{
		alert("Last name can not left blank");
		document.getElementById("lastname").focus();
		return false;
	}
	
	if(document.getElementById("city").selectedIndex == 0)
	{
		alert("Please select the city.");
		document.getElementById("city").focus();
		return false;        
	}
	if (trim(document.getElementById("mobile").value) =="")
	{
		alert("Mobile can not left blank");
		document.getElementById("mobile").focus();
		return false;
	}
	var var_mobile = document.getElementById("mobile").value;
	var len = var_mobile.length;

	if(ValidateContact(document.getElementById("mobile"))==false){
       return false;
	}
	
	if (trim(document.getElementById("email").value) =="")
	{
		alert("Email can not left blank");
		document.getElementById("email").focus();
		return false;
	}
    
    var email = theForm.email;
	if(checkEmail(email.value) == false)
	{
		   alert('Your email address seems incorrect. Please try again.');
		   email.focus();
		   return false;
	}
	
	return true;
}
//----------------- Edit Profile Validation ------------------------------------

function validateEditSubmit()
 {
	    if (document.getElementById("fname").value =="")
        {
            alert("First Name Field can not left blank");
            document.getElementById("fname").focus();
            return false;
        }
        if (document.getElementById("lname").value =="")
        {
            alert("Last Name Field can not left blank");
            document.getElementById("lname").focus();
            return false;
        }

		if(document.getElementById("reg_password").value == '') {
			alert("Please enter your Password");
			document.getElementById("reg_password").focus();
			return false;
		}
		if(document.getElementById("conPassword").value == '') {
			alert("Please enter your Confirm Password");
			document.getElementById("conPassword").focus();
			return false;
		}
		if(document.getElementById("conPassword").value != document.getElementById("reg_password").value) {
			alert("Password and Confirm Password does not match");
			document.getElementById("conPassword").focus();
			return false;
		}		

        if(document.getElementById("Email").value =="")
        {
            alert("Email id can not left blank");
            document.getElementById("Email").focus();
            return false;
        }
        var address = document.getElementById("Email").value;
        if(checkEmail(address) == false)
		{
         alert('Your email address seems incorrect. Please try again.');
		 document.getElementById("Email").focus();
         return false;
        }
		if(document.getElementById("DOB_Month").selectedIndex == 0)
        {
            alert("You should select the Month");
            document.getElementById("DOB_Month").focus();
            return false;        
        }
		if(document.getElementById("DOB_Day").selectedIndex == 0)
        {
            alert("You should select the Day");
            document.getElementById("DOB_Day").focus();
            return false;        
        }
		if(document.getElementById("DOB_Year").selectedIndex == 0)
        {
            alert("You should select the year");
            document.getElementById("DOB_Year").focus();
            return false;        
        }
		if(document.getElementById("city").selectedIndex == 0)
        {
            alert("You should select the City");
            document.getElementById("city").focus();
            return false;        
        }
       if(document.getElementById("confirm_terms_conditions").checked==false)
            {
                alert("You must agree the Terms and Conditions");
                document.getElementById("confirm_terms_conditions").focus();
                return false;
           }
		
		if(!emailChk()){
			return false;
		}
		if(document.getElementById("mob_no").selectedIndex == 0)
        {
            alert("Mobile No. Field can not left blank");
            document.getElementById("DOB_Day").focus();
            return false;        
        }
		//get_content();
		//alert(document.getElementById('admin_email_content').value)
		return true;
	}

//Coockies Handler
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}




//------------------------Start common function for Validate Refer-a-friend.php and thankyou.php --------------------------------

// check for duplicate email in array
function arrHasDupes(A) {                          // finds any duplicate array elements using the fewest possible       comparison
		var i, j, n;
		n=A.length;
														 // to ensure the fewest possible comparisons
		for (i=0; i<n; i++) {                        // outer loop uses each item i at 0 through n
			for (j=i+1; j<n; j++) {              // inner loop only compares items j at i+1 to n
				if (A[i]==A[j]){ 
				alert(A[i]+" This email address has been already entered.");
				return true;
				}
		}	}
		return false;
}

// function for remove space from string 
function trim(str) { 

	var	str1 = str.replace(/^\s\s*/,''),
		ws = /\s/,
		i = str1.length;
	while (ws.test(str1.charAt(--i)));
	return str1.slice(0, i + 1);

}
function validate_form(form)
{
	//alert(form.length) 
	if (form.txtName.value =="" || form.txtName.value =="Name")
	{
		alert("Enter your name.");
		form.txtName.focus();
		return false;
	}
	if(form.metro_city.selectedIndex == 0)
	{
		alert("Please select city.");
		form.metro_city.focus();
		return false;
	}
	if (form.txtcontact.value =="" || form.txtcontact.value =="Mobile")
	{
		alert("Enter your mobile number.");
		form.txtcontact.focus();
		return false;
	}
	if(IsNumeric(form.txtcontact.value)==false){
       alert("Enter numbers only.")
       form.txtcontact.focus();
	   return false;
	}
	var mobile = form.txtcontact.value;
    if(mobile.length !=10){
       alert("Enter valid 10-digit mobile number.\n\n For E.g. : 9323xxxxxx")
       form.txtcontact.focus();
	   return false;
 	} 
	return true;
}

function validate_refer_friend()
{
   	if (trim(document.getElementById("name").value) =="")
	{
		alert("Please enter your name.");
		document.getElementById("name").focus();
		return false;
	}
	if (trim(document.getElementById("user_email").value) =="")
	{
		alert("Please enter your Email ID.");
		document.getElementById("user_email").focus();
		return false;
	}
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = document.getElementById("user_email").value;
	if(reg.test(address) == false)
	{
	   alert('Your email address seems incorrect. Please try again.');
	   document.getElementById("user_email").focus();
	   return false;
	}
    if (trim(document.getElementById("friend_email").value) =="")
	{
		alert("Please enter your firends Email Id.");
		document.getElementById("friend_email").focus();
		return false;
	}
	var f_email = trim(document.getElementById("friend_email").value);
	var email_arr = f_email.split(",");
	var emails=new Array();
	for(var i = 0; i < email_arr.length; i++)
	{
		
		var address = trim(email_arr[i]);
		emails[i] = address; 
		if(reg.test(address) == false)
		{
			alert(address+' this email address seems incorrect. Please try again.');
			document.getElementById("friend_email").focus();
			return false;
		}
        
	}
	if(arrHasDupes(emails)== true){
		document.getElementById("friend_email").focus();
		return false;
	}
	
	return true;
}
//------------------------End common function for Validate Refer-a-friend.php and thankyou.php --------------------------------
//--------------  Start  Thankyou.php && Refer-a-friend.php common function for gmail and yahoo contact grabber  ----------------

function show_gmail()
{
	document.getElementById('friend').style.display='block';
	document.getElementById('yahoo').style.display='none';
}
function show_yahoo()
{
	document.getElementById('yahoo').style.display='block';
	document.getElementById('friend').style.display='none';
}

function popup(domain)
{
	var u = document.getElementById("yahoo_username").value;
	var p = document.getElementById("yahoo_password").value;
	var web_path = document.getElementById("web_path").value;
   

	var gmail_username = document.getElementById("gmail_username").value;
	var gmail_password = document.getElementById("gmail_password").value;
	if(domain=='gmail'){
		if(gmail_username==''){
		alert("Enter your gmail username name.");
		document.getElementById("gmail_username").focus();  
		}else if(gmail_password==''){
		alert("Enter your password.");
		document.getElementById("gmail_password").focus();  
		}else{
			var uname = (gmail_username);//base64Encode(gmail_username);
			var pswd =  reverse(gmail_password);//base64Encode(gmail_password);
  	        window.open(web_path+'import.php?username='+uname+'&~='+pswd+'','mywindow','width=560,height=500,scrollbars=yes,resizable=1,toolbar=no, menubar=no');

		}
	}
	if(domain=='yahoo'){
		if(u==''){
		alert("Enter your yahoo user name.");
		document.getElementById("yahoo_username").focus();  
		}else if(p==''){
		alert("Enter your password.");
		document.getElementById("yahoo_password").focus();  
		}else{
		  var uname = (u);//base64Encode(u);
		  var pswd = reverse(p);//base64Encode(p);
          window.open(web_path+'yahoo/index.php?username='+uname+'&~='+pswd+'','mywindow','width=560,height=500,scrollbars=yes,resizable=1,toolbar=no, menubar=no');
		}
	}

}


function reverse(my_str){
	
	//var my_str="Welcome to www.plus2net.com"

	var i=my_str.length;
	i=i-1;
    
	var rev ='';
	for (var x = i; x >=0; x--)
	{
	   if(rev=='') rev = (my_str.charAt(x));
	   else rev = rev+''+(my_str.charAt(x));

	}
	return rev;
}
function checkAll(field){
	if(document.getElementById("check_all").checked == true) {
		for (i = 0; i < field.length; i++){
			field[i].checked = true ;
		}
	} else {
			for (i = 0; i < field.length; i++){
			field[i].checked = false ;
			}
	}
}

//get email
function invite_friend()
{
	var myAddresses = "";
	if(document.frm.check.length)
	{
		for (i=0; i<document.frm.check.length; i++)
		{
			if(document.frm.check[i].checked==true)
			{
				if(myAddresses == "")
				myAddresses = document.frm.check[i].value;
				else
				myAddresses = myAddresses + "," + document.frm.check[i].value;

			}
		}
	}
	//document.getElementById("hidden_gmail").value = myAddresses;
	if (window.opener.document)
	window.opener.document.getElementById("friend_email").value = myAddresses;
	window.close();

}

function getEmails()
{
	var myAddresses = "";
	if(document.test.addresses.length)
	{
		for (i=0; i<document.test.addresses.length; i++)
		{
			if(document.test.addresses[i].checked==true)
			{
				if(myAddresses == "")
				myAddresses = document.test.addresses[i].value;
				else
				myAddresses = myAddresses + "," + document.test.addresses[i].value;

			}
		}
	}
	//document.getElementById("hidden_gmail").value = myAddresses;
	if (window.opener.document)
	window.opener.document.getElementById("friend_email").value = myAddresses;
	window.close();

}

//--------------  End  Thankyou.php && Refer-a-friend.php common function for gmail and yahoo contact grabber  ----------------



//----------------- Validate Feedback form start--------------------------------

function validate_feedback(){
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;

	if(trim(name)==''){
		alert("Please enter your full name.");
		document.getElementById('name').focus();
		return false;
	}
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

	if(trim(email)==''){
        alert("Please enter your email address.");
		document.getElementById('email').focus();
		return false;
	}
	if(reg.test(email) == false)
	{
	   alert('Your email address seems incorrect. Please try again.');
	   document.getElementById("email").focus();
	   return false;
	}
	return true;
}
//----------------- Validate Feedback form end--------------------------------


//------------------------------------- Registration validation start (common for all)-----------------------------------
function validateSubmit()
    {
	 	
	/*if(document.getElementById("ddlTitle").selectedIndex == 0)
        {
            alert("You should select the Title");
            document.getElementById("ddlTitle").focus();
            return false;        
        }*/
        if (trim(document.getElementById("fname").value) =="")
        {
            alert("First Name Field can not left blank");
            document.getElementById("fname").focus();
            return false;
        }
        if (trim(document.getElementById("lname").value) =="")
        {
            alert("Last Name Field can not left blank");
            document.getElementById("lname").focus();
            return false;
        }

		if(trim(document.getElementById("reg_password").value) == '') {
			alert("Please enter your Password");
			document.getElementById("reg_password").focus();
			return false;
		}
		if(trim(document.getElementById("conPassword").value) == '') {
			alert("Please enter your Confirm Password");
			document.getElementById("conPassword").focus();
			return false;
		}
		if(trim(document.getElementById("conPassword").value) != trim(document.getElementById("reg_password").value)) {
			alert("Password and Confirm Password does not match");
			document.getElementById("conPassword").focus();
			return false;
		}		

        if(trim(document.getElementById("Email").value) =="")
        {
            alert("Email id can not left blank");
            document.getElementById("Email").focus();
            return false;
        }
        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        var address = document.getElementById("Email").value;
        if(reg.test(address) == false)
		{
        alert('Your email address seems incorrect. Please try again.');
        return false;
        }

		if(document.getElementById("DOB_Month").selectedIndex == 0)
        {
            alert("You should select the Month");
            document.getElementById("DOB_Month").focus();
            return false;        
        }
	
    	if(document.getElementById("DOB_Day").selectedIndex == 0)
        {
            alert("You should select the Day");
            document.getElementById("DOB_Day").focus();
            return false;        
        }
		
		if(document.getElementById("DOB_Year").selectedIndex == 0)
        {
            alert("You should select the year");
            document.getElementById("DOB_Year").focus();
            return false;        
        }
	

		if(document.getElementById("city").selectedIndex == 0)
        {
            alert("You should select the City");
            document.getElementById("city").focus();
            return false;        
        }
      
		if(document.getElementById("mob_no").value == '' || document.getElementById("mob_no").value == 'Mobile No')
        {
            alert("Mobile No. Field can not left blank");
            document.getElementById("mob_no").focus();
            return false;        
        }
		if(ValidateContact(document.getElementById("mob_no"))==false){
		    return false;
		}
		if(document.getElementById("capchacode").value == '')
        {
            alert("Please enter code shown below");
            document.getElementById("capchacode").focus();
            return false;        
        }
		if(document.getElementById("confirm_terms_conditions").checked==false)
            {
                alert("You must agree the Terms and Conditions");
                document.getElementById("confirm_terms_conditions").focus();
                return false;
           }
		
		if(!emailChk()){
			return false;
		}
		
		return true;
	}

//------------------------------------- Register validation end (Register.php)-----------------------------------



//-------------------------------------Start Home page menu(index.php)-----------------------------------
function IMG1_onclick() 
    {
        document.getElementById("panelSerach").style.display="block";
        document.getElementById("pnlLoanSearch").style.display="none";
        document.getElementById("pnlInsurence").style.display="none";
		
		 document.getElementById('IMG11').style.backgroundImage = "url(images/Rupetalk222_03.gif)";
		 document.getElementById('IMG12').style.backgroundImage = "url(images/Rupetlk22_04.gif)";
		 document.getElementById('IMG13').style.backgroundImage = "url(images/Rupetlk22_05.gif)";
		 document.getElementById('IMG14').style.backgroundImage = "url(images/Rupetlk22_06.gif)";
		 document.getElementById("IMG15").style.backgroundImage = "url(images/Rupetlk22_07.gif)";
		 document.getElementById('IMG16').style.backgroundImage = "url(images/Rupetlk22_08.gif)";
        return false;
    }
	 function IMG2_onclick() 
    {
        document.getElementById("panelSerach").style.display="none";
        document.getElementById("pnlLoanSearch").style.display="block";
        document.getElementById("pnlInsurence").style.display="none";
         document.getElementById("lblSelectLoan").innerHTML="Personal Loan";
		 document.getElementById("loan_form").action="<?=WEB_PATH?>Personal-Loan/";

		 document.getElementById('IMG11').style.backgroundImage = "url(images/Rupetlk22_03.gif)";
		 document.getElementById('IMG12').style.backgroundImage = "url(images/Rupetalk222_04.gif)";
		 document.getElementById('IMG13').style.backgroundImage = "url(images/Rupetlk22_05.gif)";
		 document.getElementById('IMG14').style.backgroundImage = "url(images/Rupetlk22_06.gif)";
		 document.getElementById("IMG15").style.backgroundImage = "url(images/Rupetlk22_07.gif)";
		 document.getElementById('IMG16').style.backgroundImage = "url(images/Rupetlk22_08.gif)";
        return false;
    }
    function IMG3_onclick() 
    {
		
        document.getElementById("panelSerach").style.display="none";
        document.getElementById("pnlLoanSearch").style.display="block";
       document.getElementById("pnlInsurence").style.display="none";
		document.getElementById("lblSelectLoan").innerHTML="Home Loan";
		document.getElementById("loan_form").action="<?=WEB_PATH?>Home-Loan/";

		 document.getElementById('IMG11').style.backgroundImage = "url(images/Rupetlk22_03.gif)";
		 document.getElementById('IMG12').style.backgroundImage = "url(images/Rupetlk22_04.gif)";
		 document.getElementById('IMG13').style.backgroundImage = "url(images/Rupetalk222_05.gif)";
		 document.getElementById('IMG14').style.backgroundImage = "url(images/Rupetlk22_06.gif)";
		 document.getElementById("IMG15").style.backgroundImage = "url(images/Rupetlk22_07.gif)";
		 document.getElementById('IMG16').style.backgroundImage = "url(images/Rupetlk22_08.gif)";
        return false;
    }
    function IMG4_onclick() 
    {
         document.getElementById("panelSerach").style.display="none";
         document.getElementById("pnlLoanSearch").style.display="block";
         document.getElementById("pnlInsurence").style.display="none";
		 document.getElementById("lblSelectLoan").innerHTML="Business Loan";
		 document.getElementById("loan_form").action="<?=WEB_PATH?>Business-Loan/";

		 document.getElementById('IMG11').style.backgroundImage = "url(images/Rupetlk22_03.gif)";
		 document.getElementById('IMG12').style.backgroundImage = "url(images/Rupetlk22_04.gif)";
		 document.getElementById('IMG13').style.backgroundImage = "url(images/Rupetlk22_05.gif)";
		 document.getElementById('IMG14').style.backgroundImage = "url(images/Rupetalk222_06.gif)";
		 document.getElementById("IMG15").style.backgroundImage = "url(images/Rupetlk22_07.gif)";
		 document.getElementById('IMG16').style.backgroundImage = "url(images/Rupetlk22_08.gif)";
         return false;    
         
    }
    function IMG5_onclick() 
    {
        document.getElementById("panelSerach").style.display="none";
        document.getElementById("pnlLoanSearch").style.display="block";
        document.getElementById("pnlInsurence").style.display="none";
        document.getElementById("lblSelectLoan").innerHTML="Loan Against Property";
		document.getElementById("loan_form").action="<?=WEB_PATH?>Loan-Against-Property/";

		document.getElementById('IMG11').style.backgroundImage = "url(images/Rupetlk22_03.gif)";
		 document.getElementById('IMG12').style.backgroundImage = "url(images/Rupetlk22_04.gif)";
		 document.getElementById('IMG13').style.backgroundImage = "url(images/Rupetlk22_05.gif)";
		 document.getElementById('IMG14').style.backgroundImage = "url(images/Rupetlk22_06.gif)";
		 document.getElementById("IMG15").style.backgroundImage = "url(images/Rupetalk222_07.gif)";
		 document.getElementById('IMG16').style.backgroundImage = "url(images/Rupetlk22_08.gif)";
        return false;    
    }
    function IMG6_onclick() 
    {
        document.getElementById("panelSerach").style.display="none";
        document.getElementById("pnlLoanSearch").style.display="none";
        document.getElementById("pnlInsurence").style.display="block";

        document.getElementById('IMG11').style.backgroundImage = "url(images/Rupetlk22_03.gif)";
		 document.getElementById('IMG12').style.backgroundImage = "url(images/Rupetlk22_04.gif)";
		 document.getElementById('IMG13').style.backgroundImage = "url(images/Rupetlk22_05.gif)";
		 document.getElementById('IMG14').style.backgroundImage = "url(images/Rupetlk22_06.gif)";
		 document.getElementById("IMG15").style.backgroundImage = "url(images/Rupetlk22_07.gif)";
		 document.getElementById('IMG16').style.backgroundImage = "url(images/Rupetalk222_08.gif)";
        return false;    
    }  
//-------------------------------------End Home page Menu-----------------------------------


function popupWindow(url,w,h) {
	
	win = window.open(url ,'opupWin','width='+w+',height='+h+',left=150,top=150,resizable,scrollbars=yes');
	win.focus();
}
//------------------------------------------------------------------------------------------


function refine_search(elem){
	
    if(elem == 'expand'){
         document.getElementById('refine_search').style.display = '';
         document.getElementById('expand').style.display = 'none';
         document.getElementById('collapse').style.display = '';

	}
    if(elem == 'collapse'){
		document.getElementById('refine_search').style.display = 'none';
        document.getElementById('expand').style.display = '';
        document.getElementById('collapse').style.display = 'none';

	}

}


// Clear default values of field
function clearvalue(field,val){
	if(trim(field.value)==val){
       field.value ='';
	}
}

// only Numeric input
function isNumberKey(evt)
{
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return 0;
 }


 // Best Rate 
 function show_best_rate(div){
	    var img_path = document.getElementById('web_img_path').value; 
		if(div=='hl_inner_div'){
			document.getElementById('hl_inner_div').style.display ='';//'tabContentDiv selected';
			document.getElementById('pl_inner_div').style.display ='none';// 'tabContentDiv';
			document.getElementById('fd_inner_div').style.display ='none';
			document.getElementById('cl_inner_div').style.display ='none';

			document.getElementById('hl_img').src = img_path+'hl-wt.gif';
			document.getElementById('pl_img').src = img_path+'pl-blue.gif';
			document.getElementById('fd_img').src = img_path+'fd-blue.gif';
			document.getElementById('cl_img').src = img_path+'g-s-blue.gif';
		}
		if(div=='pl_inner_div'){
			document.getElementById('hl_inner_div').style.display ='none';//'tabContentDiv';
			document.getElementById('pl_inner_div').style.display ='';//'tabContentDiv selected';
			document.getElementById('fd_inner_div').style.display ='none';//'tabContentDiv';
			document.getElementById('cl_inner_div').style.display ='none';

			document.getElementById('hl_img').src = img_path+'hl-blue.gif';
			document.getElementById('pl_img').src = img_path+'pl-wt.gif';
			document.getElementById('fd_img').src = img_path+'fd-blue.gif';
			document.getElementById('cl_img').src = img_path+'g-s-blue.gif';
		}
		if(div=='fd_inner_div'){
			document.getElementById('hl_inner_div').style.display ='none';//'tabContentDiv';
			document.getElementById('pl_inner_div').style.display ='none';//'tabContentDiv';
			document.getElementById('fd_inner_div').style.display ='';//
			document.getElementById('cl_inner_div').style.display ='none';

			document.getElementById('hl_img').src = img_path+'hl-blue.gif';
			document.getElementById('pl_img').src = img_path+'pl-blue.gif';
			document.getElementById('fd_img').src = img_path+'fd-wt.gif';
			document.getElementById('cl_img').src = img_path+'g-s-blue.gif';
		}
		if(div=='cl_inner_div'){
			document.getElementById('hl_inner_div').style.display ='none';//'tabContentDiv';
			document.getElementById('pl_inner_div').style.display ='none';//'tabContentDiv';
			document.getElementById('fd_inner_div').style.display ='none';//'tabContentDiv selected';
			document.getElementById('cl_inner_div').style.display ='';

			document.getElementById('hl_img').src = img_path+'hl-blue.gif';
			document.getElementById('pl_img').src = img_path+'pl-blue.gif';
			document.getElementById('fd_img').src = img_path+'fd-blue.gif';
			document.getElementById('cl_img').src = img_path+'g-s-wt.gif';
		}
	}


//video-satkam-corner
function video_corner(div){
	    var img_path = document.getElementById('web_img_path').value; 
		
		if(div=='video_div'){
			document.getElementById('video_div').style.display ='';//'tabContentDiv selected';
			document.getElementById('corner_div').style.display ='none';// 'tabContentDiv';
		
			document.getElementById('video_img').src = img_path+'video-lt-blue.gif';
			document.getElementById('corner_img').src = img_path+'satkam-corner-blue.gif';
		}
		if(div=='corner_div'){
			document.getElementById('video_div').style.display ='none';//'tabContentDiv';
			document.getElementById('corner_div').style.display ='';//'tabContentDiv selected';

			document.getElementById('video_img').src = img_path+'video-blue.gif';
			document.getElementById('corner_img').src = img_path+'satkam-corner-lt-blue.gif';
		}
}



//---------------------- More poll Ajax code -------------------------------------
	function vote_now(poll_id){

		var all_que_td = 'all_que_td'+poll_id;
		var ans_rad = 'ans_rad'+poll_id;
		var all_que_td ='all_que_td'+poll_id;
		var cnt = 1 ;
        var img_path = document.getElementById("img_path").value;
        var web_path = document.getElementById("web_path").value;
		
		var ans_rad_obj = document.getElementsByName(ans_rad);
		for(var i =0; i<ans_rad_obj.length; i++){
			if(ans_rad_obj[i].checked==true) {
				var poll_ans_id = ans_rad_obj[i].value;
				cnt++;
				}
		}
		if(cnt==1){
			alert("Please check your opinion first.")
            ans_rad_obj[0].focus();   
		}else{
            document.getElementById(all_que_td).innerHTML = '<br><br><div align="center" valign="bottom"><img src="'+img_path+'loading.gif"></span><br><span class="ver12blue"><br>Loading...</div><br><br>'; 
            var definedFigures = {
			 action: 'more_poll',
			 ans: poll_ans_id,
			 poll_id: poll_id
			}
		
        ajaxCaller.get(web_path+"ajax_common.php", definedFigures, MorePollResponse, false, null);

		}

	}

function MorePollResponse(text, headers, callingContext) {
 

 var response = text.split("~");
 var all_que_td ='all_que_td'+response[1];
 var total_votes ='total_votes'+response[1];
 var vote_now_img ='vote_now_img'+response[1];

 document.getElementById(all_que_td).innerHTML = response[0]; 
 document.getElementById(total_votes).innerHTML = 'Total Votes: <B>'+response[2]+'</B>';
 document.getElementById(vote_now_img).innerHTML = '';

}
//---------------------- ----------------------------------------------------------
//----------Calculor On Home Page ----------------------------------------------------------
function validate_cal(){
var tage = trim(document.getElementById('tage').value); 
var rage = trim(document.getElementById('rage').value); 
if(tage==''){
	alert("Please enter your present age.")
	document.getElementById('tage').focus();
	return false;
}
if(IsNumeric(tage)==false){
	alert("Please enter a numeric value.")
	document.getElementById('tage').focus();
	return false;
}
if(rage==''){
	alert("Please enter your retirement age.")
	document.getElementById('rage').focus();
	return false;
}
if(IsNumeric(rage)==false){
	alert("Please enter a numeric value.")
	document.getElementById('rage').focus();
	return false;
}
if(tage > rage){
	alert("Present age cannot be greater than retirement age.")
	document.getElementById('rage').focus();
	return false;
}

return true;
}
//---------------------- ----------------------------------------------------------


//-------------------- Polling ajax function for polling.php -----------------------------------------------------------
function validate_polling(poll_form,web_path){
		  var ans_arr = poll_form.ans;
          var p =  poll_form.poll_id.value;
		  var ans_id_str = poll_form.ans_id_str.value;
		  var ans_str = poll_form.ans_str.value;
		  ans_str = ans_str.replace(new RegExp(/\\/g),"");
          var cnt =1;
		  for(var i=0;i<ans_arr.length;i++){
			  if(ans_arr[i].checked==true){
				  var poll_ans_id = ans_arr[i].value;
				  cnt++;
			  }
		  }
	 if(cnt==1){
		 alert("Please check your opinion first.");
		 ans_arr[0].focus();
	 }else{
		   document.getElementById('opinion_poll2').style.display ='';
           document.getElementById("result_td").innerHTML = '<br><br><span valign="bottom" align="center"><img src="'+web_path+'images/loading.gif"></span><br><span class="ver12blue"><br>Loading...</span><br><br>'; 
            var definedFigures = {
			ans: poll_ans_id,
			poll_id: p,
			answer_str:ans_str,
			answer_id_str:ans_id_str
			}
		 ajaxCaller.get(web_path+"ajax_poll.php", definedFigures, PollResponse, false, null);
	 }
      return false;
 
}
// this function will get the data from db & put it into var text with | delim. here we split them & again put that into form element
function PollResponse(text, headers, callingContext) {
	document.getElementById("result_td").innerHTML = text;
    return false;
}
//---------------------------------------------------------------------------------


//----------  validate share your exper-----------------------------------------------------------------------
function validate_share_exper(){
	var name = trim(document.getElementById('name').value);
	var email = trim(document.getElementById('email').value);
	var loan_amount = trim(document.getElementById('loan_amount').value);
	var intrest_rate = trim(document.getElementById('intrest_rate').value);
	var bank_name = trim(document.getElementById('bank_name').value);
	var city = trim(document.getElementById('city').value);
    
    if(name==''){
		alert("Please enter your name.");
		document.getElementById('name').focus();
        return false;    
	}
	if(email==''){
		alert("Please enter your email id.");
		document.getElementById('email').focus();
        return false;    
	}
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(reg.test(email) == false)
	{
	alert('Your email address seems incorrect. Please try again.');
	document.getElementById('email').focus();	
	return false;
	}

	if(loan_amount==''){
		alert("Please enter loan amount.");
		document.getElementById('loan_amount').focus();
        return false;    
	}
	if(intrest_rate==''){
		alert("Please enter intrest rate.");
		document.getElementById('intrest_rate').focus();
        return false;    
	}

	if(bank_name==''){
		alert("Please enter bank name.");
		document.getElementById('bank_name').focus();
        return false;    
	}
	if(city==''){
		alert("Please select your city name.");
		document.getElementById('city').focus();
        return false;    
	}
    return true;
}

//-------------------- text area max length-----------------------//
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}


//-----------flat rate---------------//
function show_flat_rate(div){
	    var img_path = document.getElementById('web_img_path').value; 
		if(div=='smallflat_div'){
			document.getElementById('smallflat_div').style.display ='';//'tabContentDiv selected';
			document.getElementById('largeflat_div').style.display ='none';// 'tabContentDiv';
		

			document.getElementById('small_flat_img').src = img_path+'small-flat2.gif';
			document.getElementById('large_flat_img').src = img_path+'large-flat.gif';
	
		}
		if(div=='largeflat_div'){
			document.getElementById('largeflat_div').style.display ='';//'tabContentDiv';
			document.getElementById('smallflat_div').style.display ='none';//'tabContentDiv selected';

			document.getElementById('small_flat_img').src = img_path+'small-flat.gif';
			document.getElementById('large_flat_img').src = img_path+'large-flat2.gif';

		}
}

//---------------- js for category drop down ----------------------------//
function show_category(web_path){
	var core_id = document.getElementById('DrpListproduct').value;
	var act = 'show_category';
	var bodyVars = {
		action : act,
		product_id : core_id
	}
	document.getElementById('category').disabled = true;
   	var URLVars = ''; 
	ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, ProductCategoryResponse, false, null);
}

function ProductCategoryResponse(text, headers, callingContext) {
    text = trim(text);
	document.getElementById('category').disabled = false;
    document.getElementById('category_td').innerHTML = text;
}
//------------------------------------------------------------------------//


//---------SUbscrib now news letter home page ------------------------------------------//
function subscribe_now(core_id,web_path){
    var email = trim(document.getElementById('subscriber_email').value);
	//var source = mail_source+'-Bottom'; 
	try
	{
	   var mail_source = trim(document.getElementById('mail_source').value);
	   mail_source = mail_source+'-Bottom';
	}
	catch(err)
	{
	  var mail_source = 'subscribe_now';
	}
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var act = 'subscribe_now';
	if(email=='' || email=='Email Id'){
       alert('Please enter email address.\nE.g. email@domain.com');
		document.getElementById('subscriber_email').focus();	
		return false;
	}else
    if(reg.test(email) == false)
	{
		alert('Your email address seems incorrect.\n Please enter valid email address.\n E.g. email@domain.com');
		document.getElementById('subscriber_email').focus();	
		return false;
	}else{
		document.getElementById('subscribe-td').innerHTML = '<table border="0" width="100%"><tr><td align="right"><img src="'+web_path+'images/loading-bar.gif"></td><td class="ver11blue">subscribing...&nbsp;&nbsp;</td></tr></table>';
		var bodyVars = {
			action : act,
			email : email,
			product_id : core_id,
			mail_source : mail_source
		}
		var URLVars = ''; 
		ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, SubscribeNowResponse, false, null);
	}
}
function SubscribeNowResponse(text, headers, callingContext) {
   
   text = trim(text);
   var response = text.split("~");
   if(response[0] == 'succ'){
		//document.getElementById('subscribe-td').innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue">Thank you for subscribing to Rupeetalk’s free newsletter.</td></tr></table>';
		var ref_id = response[1];
		var web_path = response[2];
		window.location = web_path+'subscrib-thankyou.php?ref_id='+ref_id+'&dis_msg=newsalert';
   }
   if(response[0] == 'duplicate'){
	  document.getElementById('subscribe-td').innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue">You are already subscribed.</td></tr></table>';
   }
   if(response[0] != 'duplicate' && response[0] != 'succ' ){
      document.getElementById('subscribe-td').innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue" style="color:red">Error occured .Please try latter!</td></tr></table>' ;
   }
}
//--------------------------------------------------------------------------//


//------------------Home page Light box -------------------------------------------//
function show_lightbox(web_path,div,core_id){

	var content = document.getElementById(div).innerHTML;
	document.getElementById('light').innerHTML = '<input type="hidden" value="'+core_id+'" name="hid_product" id="hid_product" ><div style="position:absolute;left:285px;top:8px;"><img src="'+web_path+'images/close.jpeg" border="0" onclick="close_lightbox();"></div><div id="sub_div_content">'+content+'</div>';
	document.getElementById('light').style.display='block';
	document.getElementById('fade').style.display='block'
}

function close_lightbox(){
	document.getElementById('light').style.display='none';
	document.getElementById('fade').style.display='none';
	document.body.style.overflowY = 'scroll';
}
//----------------------------------------------------------------------------------------//
//---------------- Subscribe now RATE ALERT home page ------------------------------------//
function subscribe_now2(core_id,web_path){
    
	if(core_id=='' || core_id==0){
	   core_id = trim(document.getElementById('hid_product').value);
	}
    var sub_mobile = 'sub_mobile'+core_id;  
    var sub_email = 'sub_email'+core_id;
	var mobile = (document.getElementById(sub_mobile).value);
	var email = (document.getElementById(sub_email).value);
	var c = 1;   
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if((email=='' && mobile=='') || (mobile=='Mobile No.' && email=='E-mail')){
        alert('Please enter email address OR mobile number.');
		document.getElementById(sub_mobile).focus();	
		return false;
	}
    
	if(email=='' || email=='E-mail'){
		if(mobile!='Mobile No.')
		{
			var first_char = mobile.substr(0,1); 
			if (!IsNumeric(mobile))
			{
				alert("Mobile Field must be numeric");
				document.getElementById(sub_mobile).focus();
				return false;
			}
			if(mobile.length != 10){
				alert("Please enter valid mobile number.Eg. 9823xxxxxx");
				document.getElementById(sub_mobile).focus();	
				return false;
			}
			if(first_char!=9 && first_char!=8){
				alert("Please enter valid mobile number.Eg. 9823xxxxxx");
				document.getElementById(sub_mobile).focus();	
				return false;		
			}
	    }
	}
	if(mobile=='' || mobile=='Mobile No.'){
		if(email!='E-mail'){
			if(reg.test(email) == false)
			{
				alert('Your email address seems incorrect.\n Please enter valid email address.\n E.g. email@domain.com');
				document.getElementById(sub_email).focus();	
				return false;
			}
		}
	}
	if(email!='' && email!='E-mail'){
			if(reg.test(email) == false)
			{
				alert('Your email address seems incorrect.\n Please enter valid email address.\n E.g. email@domain.com');
				document.getElementById(sub_email).focus();	
				return false;
			}
	}

 		if(email=='E-mail'){ email='';}
 		if(mobile=='Mobile No.'){mobile='';}
		if(email=='' && mobile==''){
				alert('Please enter email address OR mobile number.');
				document.getElementById(sub_mobile).focus();	
				return false;
		}else{
			var td = 'subscribenow2-td'+core_id;
			document.getElementById(td).innerHTML = '<table border="0" width="100%"><tr><td align="right"><img src="'+web_path+'images/loading-bar.gif"></td><td class="ver11blue">subscribing...&nbsp;&nbsp;</td></tr></table>';
			var act = 'subscribe_now_multi';
			var bodyVars = {
				action : act,
				product_id : core_id,
				email : email,
				mobile: mobile
          	}
			var URLVars = ''; 
			ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, SubscribeNowMultiResponse, false, null);
			return false;  
	}
	
   return false;
}
function SubscribeNowMultiResponse(text, headers, callingContext) {
 
   t = trim(text);
   var text = t.split("~");
   var core_id = text[1];
   var ref_id = text[2];
   var td =  'subscribenow2-td'+core_id;
   if(text[0] == "succ"){
     //document.getElementById(td).innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue">Thank you for subscribing to our free alerts.</td></tr></table>';
	  window.location = text[4]+'subscrib-thankyou.php?ref_id='+ref_id+'&dis_msg=ratealert&source='+text[3];
   }else
   if(text[0] == "duplicate"){
	  document.getElementById(td).innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue">You are already subscribed.</td></tr></table>';
   }else
   {
      document.getElementById(td).innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue" style="color:red">Error occured .Please try latter!</td></tr></table>' ;
   }
}
//---------------------------------------------------------------------------------//

//----------------------- Subscrib now newsletter home page -----------------------//
function subscribe_news(core_id,web_path){

    var email = trim(document.getElementById('news_subscriber_email').value);
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(email=='' || email=='Enter E-mail'){
       alert('Please enter email address.\nE.g. email@domain.com');
		document.getElementById('news_subscriber_email').focus();	
		return false;
	}else
    if(reg.test(email) == false)
	{
		alert('Your email address seems incorrect.\n Please enter valid email address.\n E.g. email@domain.com');
		document.getElementById('news_subscriber_email').focus();	
		return false;
	}else{
		document.getElementById('subscribenews-td').innerHTML = '<table border="0" width="100%"><tr><td align="right"><img src="'+web_path+'images/loading-bar.gif"></td><td class="ver11blue">subscribing...&nbsp;&nbsp;</td></tr></table>';
		var act = 'subscribe_now';
		var bodyVars = {
			action : act,
			product_id : core_id,
			email : email
		}
		var URLVars = ''; 
		ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, SubscribeNewsResponse, false, null);
	}

}
function SubscribeNewsResponse(text, headers, callingContext) {
   
   text = trim(text);
   var response = text.split("~");
   if(response[0] == 'succ'){
		//document.getElementById('subscribenews-td').innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue">Thank you for subscribing to our free alerts.</td></tr></table>';
		var ref_id = response[1];
		window.location = response[2]+'subscrib-thankyou.php?ref_id='+ref_id+'&dis_msg=newsalert';
   }
   if(response[0] == 'duplicate'){
	  document.getElementById('subscribenews-td').innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue">You are already subscribed.</td></tr></table>';
   }
   if(response[0] != 'duplicate' && response[0] != 'succ' ){
      document.getElementById('subscribenews-td').innerHTML = '<table border="0" width="100%"><tr><td align="center" class="ver11blue" style="color:red">Error occured .Please try latter!</td></tr></table>' ;
   }
  // pageTracker._trackPageview('/Subscribe/Email_Alert');
}


//free-alerts page

function subscribe_now_free_alert(core_id,web_path,mail_source1){
	
    var email = trim(document.getElementById('fa_email').value);
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var act = 'subscribe_now';
	if(email=='' || email=='Email Id'){
       alert('Please enter email address.\nE.g. email@domain.com');
		document.getElementById('fa_email').focus();	
		return false;
	}else
    if(reg.test(email) == false)
	{
		alert('Your email address seems incorrect.\n Please enter valid email address.\n E.g. email@domain.com');
		document.getElementById('fa_email').focus();	
		return false;
	}else{
		//var mail_source1 = 'landing_subscribe_now';
		if(mail_source1 != 'wealth_landing_subscribe_now2'){
		    document.getElementById('fa_td').innerHTML = '<table border="0" width="100%"><tr><td align="right"><img src="'+web_path+'images/loading-bar.gif"></td><td class="ver11blue">subscribing...&nbsp;&nbsp;</td></tr></table>';
		}
		var bodyVars = {
			action : act,
			email : email,
			product_id : core_id,
            mail_source : mail_source1
		}
		var URLVars = ''; 
		ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, FAResponse, false, null);
	}

}

function subscribe_now_free_alert2(core_id,web_path,mail_source1){
	
    var email = trim(document.getElementById('fa_email2').value);
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var act = 'subscribe_now';
	if(email=='' || email=='Email Id'){
       alert('Please enter email address.\nE.g. email@domain.com');
		document.getElementById('fa_email2').focus();	
		return false;
	}else
    if(reg.test(email) == false)
	{
		alert('Your email address seems incorrect.\n Please enter valid email address.\n E.g. email@domain.com');
		document.getElementById('fa_email2').focus();	
		return false;
	}else{
		//var mail_source1 = 'landing_subscribe_now';
		document.getElementById('fa_td2').innerHTML = '<table border="0" width="100%"><tr><td align="right"><img src="'+web_path+'images/loading-bar.gif"></td><td class="ver11blue">subscribing...&nbsp;&nbsp;</td></tr></table>';
		
		var bodyVars = {
			action : act,
			email : email,
			product_id : core_id,
            mail_source : mail_source1
		}
		var URLVars = ''; 
		ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, FAResponse, false, null);
	}

}

function FAResponse(text, headers, callingContext) {

   text = trim(text);
   var response = text.split("~");

   //if(response[0] == 'succ'){
   //document.getElementById('free-alerts').innerHTML = '<br><table border="0"><tr><td align="center" class="ver12blue">Thank you for subscribing to our free alerts.</td></tr></table>';
	 var ref_id = response[1];
	 window.location = response[2]+'subscrib-thankyou.php?ref_id='+ref_id+'&dis_msg=newsalert';

  // }
   if(response[0] == 'duplicate'){
	  document.getElementById('free-alerts').innerHTML = '<br><table border="0"><tr><td align="center" class="ver12blue">You are already subscribed.</td></tr></table>';
   }
   if(response[0] != 'duplicate' && response[0] != 'succ' ){
      document.getElementById('free-alerts').innerHTML = '<br><table border="0"><tr><td align="center" class="ver12blue">Error occured .Please try latter!</td></tr></table>' ;
   }
  // pageTracker._trackPageview('/Subscribe/Email_Alert');
}



function show_reviews(div,path){
    
	var img_path = path+'images/'; //document.getElementById('web_path').value; 
   
	if(div=='cc_div'){
		document.getElementById('cc_div').style.display ='';//'tabContentDiv selected';
		document.getElementById('hl_div').style.display ='none';// 'tabContentDiv';
		document.getElementById('li_div').style.display ='none';
		document.getElementById('pl_div').style.display ='none';

		document.getElementById('review-cc').src = img_path+'cc-blu.gif';
		document.getElementById('review-hl').src = img_path+'hl-blk.gif';
		document.getElementById('review-li').src = img_path+'li-blk.gif';
		document.getElementById('review-pl').src = img_path+'pl-blk.gif';
	}
	if(div=='hl_div'){
		document.getElementById('cc_div').style.display ='none';//
		document.getElementById('hl_div').style.display ='';
		document.getElementById('li_div').style.display ='none';
		document.getElementById('pl_div').style.display ='none';

		document.getElementById('review-cc').src = img_path+'cc-blk.gif';
		document.getElementById('review-hl').src = img_path+'hl-blu.gif';
		document.getElementById('review-li').src = img_path+'li-blk.gif';
		document.getElementById('review-pl').src = img_path+'pl-blk.gif';
	}
	if(div=='li_div'){
		document.getElementById('cc_div').style.display ='none';//
		document.getElementById('hl_div').style.display ='none';// 'tabContentDiv';
		document.getElementById('li_div').style.display ='';
		document.getElementById('pl_div').style.display ='none';

		document.getElementById('review-cc').src = img_path+'cc-blk.gif';
		document.getElementById('review-hl').src = img_path+'hl-blk.gif';
		document.getElementById('review-li').src = img_path+'li-blu.gif';
		document.getElementById('review-pl').src = img_path+'pl-blk.gif';
	}
	if(div=='pl_div'){
		document.getElementById('cc_div').style.display ='none';//'tabContentDiv selected';
		document.getElementById('hl_div').style.display ='none';// 'tabContentDiv';
		document.getElementById('li_div').style.display ='none';
		document.getElementById('pl_div').style.display ='';

		document.getElementById('review-cc').src = img_path+'cc-blk.gif';
		document.getElementById('review-hl').src = img_path+'hl-blk.gif';
		document.getElementById('review-li').src = img_path+'li-blk.gif';
		document.getElementById('review-pl').src = img_path+'pl-blu.gif';
	}
}


function show_market_live(div,web_path){
	
	var sensex_liv_img = '<img src="http://www.bseindia.com/Sensex/charts/Sensex.png" border="0"/>';
	var nifty_liv_img = '<img src="http://www.nseindia.com/nifty_new.png" border="0" width="280px" height="170px"/>';

	if(div=='sensex_img'){
       document.getElementById(div).src = web_path+'images/sensex-blue.gif';
       document.getElementById('nifty_img').src = web_path+'images/nifty-grey.gif';
       document.getElementById('sensex_tr').style.display ='';
       document.getElementById('nifty_tr').style.display ='none';
	   document.getElementById("market_live").innerHTML = sensex_liv_img;
	   document.getElementById("more-stock-td").innerHTML = '<a href="stock-bse.php">View more &raquo;</a>';

	}
	if(div=='nifty_img'){
	   document.getElementById(div).src = web_path+'images/nifty-blue.gif';
       document.getElementById('sensex_img').src = web_path+'images/sensex-grey.gif';
	   document.getElementById('nifty_tr').style.display ='';
	   document.getElementById('sensex_tr').style.display ='none';
	   document.getElementById("market_live").innerHTML = nifty_liv_img;
	   document.getElementById("more-stock-td").innerHTML = '<a href="stock-nse.php">View more &raquo;</a>';
	}

}
//--------------------------- Subscribe now again from thankyou page ---------------------------------//

function thankyou_subscribe(mail_source,ref_id){

   if(ref_id){
		var product_str = '';
		var c = 0;
		var f = 0;
		try
		{
			
			var pro_ids = document.getElementsByName('chk_product[]');
			
			for(var i=0;i<pro_ids.length;i++){
			   if(pro_ids[i].checked==true){ 
				   c++;
				   if(product_str == '') product_str = pro_ids[i].value;
			       else product_str = product_str+','+pro_ids[i].value;
				}
			}
		
		}
		catch(err)
		{
		   var product_str = ''; 
		}
            if(mail_source=='subscribe_now_best_rates' && c==0) {
				alert("Please select atleast one product for rate alert.");
			}else{
    		var act = 'subscribe_by_thankyou';
			document.getElementById('sth_td').innerHTML = '<table border="0" width="100%"><tr><td align="right"><img src="images/loading-bar.gif"></td><td class="ver11blue">subscribing...&nbsp;&nbsp;</td></tr></table>';
			var bodyVars = {
				action : act,
				ref_id : ref_id,
				mail_source : mail_source,
				product_str : product_str
			}
			var URLVars = ''; 
			ajaxCaller.postVars("ajax_common.php", bodyVars,URLVars, ThankyouResponse, false, null);
			}
	
	}

}

function ThankyouResponse(text, headers, callingContext) {
   
	text = trim(text);
	
	var response = text.split("~");
	if(response[0] == 'succ'){
	 document.getElementById('sth_td').innerHTML = '<br><table border="0" class="borderTablelight"  width="425"><tr><td align="center" class="ver12blue">Thank you for subscribing to our free alerts.</td></tr></table>';
	}
	if(response[0] == 'duplicate'){
	  document.getElementById('sth_td').innerHTML = '<br><table border="0" class="borderTablelight"  width="425"><tr><td align="center" class="ver12blue">You are already subscribed.</td></tr></table>';
	}
	if(response[0] != 'duplicate' && response[0] != 'succ' ){
	  document.getElementById('sth_td').innerHTML = '<br><table border="0" class="borderTablelight"  width="425"><tr><td align="center" class="ver12blue">Error occured .Please try latter!</td></tr></table>' ;
	}
  
}


//------------ Cookie functions ------------------------//
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
} 
//------------ Cookie functions  end------------------------//

//-------------------Car Insurance validation ---------------//
function policy_type_control(){
	var policy_type = document.getElementsByName('policy_type');
	if(policy_type[0].checked==true) document.getElementById('prev_insurer').disabled = true;
	else document.getElementById('prev_insurer').disabled = false; 
}

function  validate_car_insurance(){

	var fname = document.getElementById('fname').value;
	var mobile = document.getElementById('mobile').value;
	var email = document.getElementById('email').value;
	var city = document.getElementById('city').value;
	var policy_type = document.getElementsByName('policy_type');
	var make = document.getElementById('make').value;
	var mod = document.getElementById('mod').value;
	var eng_cc = document.getElementById('eng_cc').value;
	var yom = document.getElementById('yom').value;
	var st = document.getElementById('st').value;
	var prev_insurer = document.getElementById('prev_insurer').value;
	var renew_date = document.getElementById('renew_date').value;
	
	

	if(fname==''){
        alert("Please enter your full name.");
        document.getElementById('fname').focus();  
		return false;
	}
	if(mobile==''){
        alert("Please enter your mobile number.");
        document.getElementById('mobile').focus();  
		return false;
	}
	if(ValidateContact(document.getElementById('mobile'))==false){
	    return false;
	}
	if(email==''){
        alert("Please enter your email.");
        document.getElementById('email').focus();  
		return false;
 	}
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    if(reg.test(email) == false)
	{
		alert('Your email address seems incorrect.\n Please enter valid email address.\n E.g. email@domain.com');
		document.getElementById('email').focus();	
		return false;
	}
    if(city==''){
        alert("Please select your city.");
        document.getElementById('city').focus();  
		return false;
	}
	if(policy_type[0].checked==false && policy_type[1].checked==false){
		alert("Please select policy type.");
		policy_type[0].focus();
		return false;
	}
    if(make==''){
        alert("Please select make.");
        document.getElementById('make').focus();  
		return false;
	}
	if(mod==''){
        alert("Please select model.");
        document.getElementById('mod').focus();  
		return false;
	}
	if(eng_cc==''){
        alert("Please select engine cc.");
        document.getElementById('eng_cc').focus();  
		return false;
	}
    if(yom==''){
        alert("Please select year of manufacture.");
        document.getElementById('yom').focus();  
		return false;
	}
	if(st==''){
        alert("Please select state where car is registered .");
        document.getElementById('st').focus();  
		return false;
	}
	if(renew_date==''){
        alert("Please select policy renewal date.");
        document.getElementById('renew_date').focus();    
		return false;
	}
	return true; 
}

//------------ top banner----------------//
function validate_top_banner_form(frm){

  var name = trim(frm.txtName.value);
  var contact = trim(frm.txtcontact.value);
  if(name=='' || name=='Name') {
     alert("Please enter your name.")
     frm.txtName.focus();
	 return false
  }
  if(contact == '' || contact == 'Mobile') {
     alert("Please enter your contact number.")
     frm.txtcontact.focus();
	 return false
  }
  if(ValidateContact(frm.txtcontact)==false){
       return false;
  }
  
}
//-----------------------------------------//

function fnLoading(caption, object , showimg){
	var picsrc = "";
	var data = "";
	if(showimg){
		picsrc = "<img src='"+showimg+"' align=absmiddle border=0>";
	}
	data = "<table class='clsGeneralText' width='100%'><tr><td align=center valign=middle>" + picsrc + "&nbsp; &nbsp;<br> " + caption + "</td></tr></table>";
	document.getElementById(object).innerHTML = data;
}

function RemoveDuplicates(arr)
{
	//get sorted array as input and returns the same array without duplicates.
	var result=new Array();
	var lastValue="";
	for (var i=0; i<arr.length; i++)
	{
	var curValue=arr[i];
	if (curValue != lastValue)
	{
	result[result.length] = curValue;
	}
	lastValue=curValue;
	}
	return result;
}


function show_top_provider(tdName){
    
	var arr = new Array('hl','pl','li','hi','cc','da');
	for(var i=0;i<6;i++){
      var td = 'home-'+arr[i]+'-td';  
      var div = 'home-'+arr[i]+'-div';
      var cal = 'home-'+arr[i]+'-cal';
	  if(td == tdName){
	      document.getElementById(div).style.display ='block';
	      document.getElementById(cal).style.display ='block';
		  document.getElementById(td).className ='home-tab-active hand';
	  }else{
		  document.getElementById(div).style.display ='none';
		  document.getElementById(cal).style.display ='none';
		  document.getElementById(td).className ='home-tab-nonactive hand';
	  }
    }//for

}

function show_sg_provider(tdName){
   // alert(tdName);
	var arr = new Array('hl','pl','li','hi');
	for(var i=0;i<4;i++){
      var td = 'home-'+arr[i]+'-td1';  
      var div = 'home-'+arr[i]+'-div1';
	  if(td == tdName){
	      document.getElementById(div).style.display ='block';
		  document.getElementById(td).className ='home-tab-active hand';
	  }else{
		  document.getElementById(div).style.display ='none';
		  document.getElementById(td).className ='home-tab-nonactive hand';
	  }
    }//for

}


function validate_download_form(theform){
	alert("here");

}

function home_loan_consultations(web_path){
	
		document.getElementById('fade').style.display='block';
		document.getElementById('light').style.display='block';

		document.getElementById('light').innerHTML = document.getElementById('hidden_hl_cons').innerHTML;
		window.location.hash = "#";	

}


//---------------jquery sorting function start---------------------------

function sort_top_rated_product(product_id){

if(product_id == 3){
	var table_class = "#table"+product_id;
    $(table_class).tablesorter({ 
        headers: { 0 : { sorter: false}, 4 : { sorter: false } },
		sortList: [[3,1]]  
    }); 

}if(product_id == 2){
	var table_class = "#table"+product_id;
    $(table_class).tablesorter({ 
        headers: { 0 : { sorter: false}, 4 : { sorter: false } },
		sortList: [[3,1]]  
    });

}if(product_id == 6){
	var table_class = "#table"+product_id;
    $(table_class).tablesorter({ 
        headers: { 0 : { sorter: false}, 3 : { sorter: false } } 
    }); 

}if(product_id == 7){
	var table_class = "#table"+product_id;
    $(table_class).tablesorter({ 
        headers: { 0 : { sorter: false}, 3 : { sorter: false } } 
    }); 

}if(product_id == 1){
	var table_class = "#table"+product_id;
    $(table_class).tablesorter({ 
        headers: { 0 : { sorter: false}, 4 : { sorter: false } },
		sortList: [[3,1]]  
    }); 
}if(product_id == 10){
	var table_class = "#table"+product_id;
    $(table_class).tablesorter({ 
        headers: { 0 : { sorter: false}, 4 : { sorter: false } } 
    }); 
}


}


//----------------jquery sorting function end------------------------
