function slideD(id)
{
	var id = "#" + id
	$(id).slideDown("slow");
}
function slideU(id)
{
	var id = "#" + id
	$(id).slideUp("slow");
}
function fadein(id)
{
	var id = "#" + id
	$(id).fadeIn("slow");
}
function fadeout(id)
{
	var id = "#" + id
	$(id).fadeOut("slow");
}
function elehide(id)
{
	document.getElementById(id).style.display = "none";
}
function eleshow(id)
{
	document.getElementById(id).style.display = "block";
}

function flicktestimonials(currid)
{
	var total = 5;
	var precontid = "testi";
	var prelinkid = "testilink";
	var prephid = "testph";
	for(i=1;i<=Number(total);i++)
	{
		var contid = precontid + i;
		var linkid = prelinkid + i;
		var phid = prephid + i;
		if(i == Number(currid))
		{
			new fadein(contid);
			document.getElementById(phid).style.backgroundColor = "#666666";
			//new elehide(headid);
		}
		else
		{
			new elehide(contid);
			document.getElementById(phid).style.backgroundColor = "#333333";			
			//new eleshow(headid);
		}
	}
}

function openPage(pageURL,pageName,popWidth,popHeight)
{
	var centerWidth  = (screen.width/2)-(popWidth/2);
	var centerHeight = (screen.height/2)-(popHeight/2);

	var openPage = window.open(pageURL,pageName,'height='+popHeight+',width='+popWidth+',top='+centerHeight+',left='+centerWidth+',directories=no,location=no,menubar=no,resizable,status=no,toolbar=no,history=no,scrollbars');
	openPage.focus();
}

function openPageNoScroll(pageURL,pageName,popWidth,popHeight)
{
	var centerWidth  = (screen.width/2)-(popWidth/2);
	var centerHeight = (screen.height/2)-(popHeight/2);

	var openPage = window.open(pageURL,pageName,'height='+popHeight+',width='+popWidth+',top='+centerHeight+',left='+centerWidth+',directories=no,location=no,menubar=no,resizable=no,status=no,toolbar=no,history=no,scrollbars=no');
	openPage.focus();
}

function popitup(url)
{
	window.open(url,'newwindow','width=690,height=500,scrollbars=1,top=50,left=200')
}

function formSubmit(payURL, payId, payName, country, currency)
{		
	document.payForm.paymodeId.value = payId;
	document.payForm.paymodeName.value = payName;
	document.payForm.action = payURL+"?sendercountry="+country+"&sendercurrency="+currency;
	document.payForm.submit();
}

function formSubmitUrl(payURL, payId, payName, country, currency, uiId)
{		
	document.payForm.paymodeId.value = payId;
	document.payForm.paymodeName.value = payName;
	document.payForm.action = payURL+"&sendercountry="+country+"&sendercurrency="+currency;
	document.payForm.submit();
}


function openPopUpPage(pageURL,pageName,popWidth,popHeight)
{
	var centerWidth  = (screen.width/2)-(popWidth/2);
	var centerHeight = (screen.height/2)-(popHeight/2);

	var openPage = window.open(pageURL,pageName,'height='+popHeight+',width='+popWidth+',top='+centerHeight+',left='+centerWidth+',directories=no,location=no,menubar=no,resizable,status=no,toolbar=no,history=no,scrollbars');
	//parent.window.focus();
}

function openPage12(pageURL,pageName,popWidth,popHeight)
{
	var centerWidth  = (screen.width/2)-(popWidth/2);
	var centerHeight = (screen.height/2)-(popHeight/2);

	var openPage = window.open(pageURL,pageName,'height='+popHeight+',width='+popWidth+',top='+centerHeight+',left='+centerWidth+',directories=no,location=no,menubar=no,resizable=no,status=no,toolbar=no,history=no,scrollbars=no');
	openPage.focus();
}

function openpop()
{
	window.open('rmt_popup.jsp','200','200');
}

function validateContactUsForm(fname,lname,phone,product,subject,email,country,custStatus,custOwnerId,custQuery,btmContactUsForm)
{
	initialize_error_msgs();

	validate_mandatory_tb_with_message(fname, "Please enter your First Name");
	validate_textbox_space_with_msg(fname," First Name");
	validate_special_char(fname," First Name");

	validate_mandatory_tb_with_message(lname, "Please enter your Last Name");
	validate_textbox_space_with_msg(lname," Last Name");
	validate_special_char(lname," Last Name");
	
	validate_mandatory_tb_with_message(phone, "Please enter your Phone No");
	validate_textbox_space_with_msg(phone," Phone No");
	validate_numeric_value_with_msg(phone," Phone No");
	
	validate_mandatory_tb_with_message(product, "Please select the Product");

	validate_mandatory_tb_with_message(subject, "Please select your Subject");

	validate_email_value(email);

	validate_mandatory_tb_with_message(country, "Please select your Country");

	validate_mandatory_tb_with_message(custStatus, "Please select your Status");
	if(custStatus.value == 'Existing Customer')
	{
		//Owner Id changed to Loging Id
		validate_mandatory_tb_with_message(custOwnerId, "Please enter your Login Id");
		validate_textbox_space_with_msg(custOwnerId," Login Id");
//		validate_numeric_value_with_msg(custOwnerId," Owner Id");
	}
	
	validate_mandatory_tb_with_message(custQuery, "Please enter your Query");
	
	return check_display_errors(btmContactUsForm);
}

function ShowContent(ID)
{
	div = document.getElementById(ID);
	div.style.visibility = "visible"// if it doesnt work try div.style.visibility = true
}

function HideContent(ID)
{
	div = document.getElementById(ID);
	div.style.visibility = "hidden"// if it doesnt work try div.style.visibility = true
}

function submitCharity(uiId)
{
	var charityVal = document.charityForm.others.value;
	if(charityVal == "Karuna Sethu Trust")
	{
		//document.charityForm.action="r2i_online_donation_karunaSetuTrust.jsp";
		window.location.href='r2i_online_donation_karunaSetuTrust.jsp?uiId='+uiId;
	}
	else if(charityVal == "Cancer Aid and Research")
	{
		window.location.href='r2i_online_donation_CancerAidsFoundation.jsp?uiId='+uiId;
	}
	else if(charityVal == "Make a Wish Foundation")
	{
		window.location.href='r2i_online_donation_wishFoundation.jsp?uiId='+uiId;
	}
	else if(charityVal == "IDA india")
	{
		window.location.href='r2i_online_donation_IDA.jsp?uiId='+uiId;
	}
	else if(charityVal == "Karunaii")
	{
		window.location.href='r2i_online_donation_karunaiiTrust.jsp?uiId='+uiId;
	}
	else if(charityVal == "Help Age India")
	{
		window.location.href='r2i_online_donation_help.jsp?uiId='+uiId;
	}
	else if(charityVal == "Lovedale Foundation")
	{
		window.location.href='r2i_online_donation_lovedalefoundation.jsp?uiId='+uiId;
	}
	else if(charityVal == "Support India")
	{
		window.location.href='r2i_online_donation_supportIndia.jsp?uiId='+uiId;
	}
	else if(charityVal == "Natl. assoc for the blind")
	{
		window.location.href='r2i_online_donation_blindASS.jsp?uiId='+uiId;
	}
	else if(charityVal == "PM relief fund")
	{
		window.location.href='r2i_online_PMDonation.jsp?uiId='+uiId;
	}

	//document.charityForm.submit();
}

var mybrowser = navigator.appName;
function mortabs(currid)
{
	var total = 5;
	var tabpre = "mortab_";
	var tabcontpre = "mortabcont_";
	for(i=1;i<=total;i++)
	{
		var tabid = tabpre + i;
		var tabcontid = tabcontpre + i;		
		if(Number(currid) == i)
		{
			document.getElementById(tabid).className = "mortabhead_on";	
			if(mybrowser.match("Microsoft") != null)
			{
				document.getElementById(tabcontid).style.display = "inline";	
			}
			else	
			{
				document.getElementById(tabcontid).style.display = "table-row";		
			}
		}
		else
		{
			document.getElementById(tabid).className = "mortabhead_off";	
			document.getElementById(tabcontid).style.display = "none";	
		}
	}
}
function validateRegForm(fname,email,homeNo1,homeNo2,homeNo3,country,regForm)
{
	initialize_error_msgs();

	validate_mandatory_tb_with_message(fname, "Please enter your First Name");
 	validate_textbox_space_with_msg(fname,"First Name ");
	validate_special_char(fname,"First Name ");

	validate_email_value(email);

	validate_mandatory_tb_with_message(homeNo1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo1," Country Code");
	validate_numeric_value_with_msg(homeNo1,"Country Code ");

	validate_mandatory_tb_with_message(homeNo2, "Area Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo2,"Area Code");
	validate_numeric_value_with_msg(homeNo2,"Area Code");

	validate_mandatory_tb_with_message(homeNo3, "Telephone No of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo3,"Day-time Phone");
	validate_numeric_value_with_msg(homeNo3,"Day-time Phone");

	return check_display_errors(regForm);
}

function switchtab(currid)
{
	var total = 5;
	var pretabcont = "tabcont";
	var pretabhead = "tab";
	for(i=1;i<=total;i++)
	{
		var contid = pretabcont + i;
		var tabid = pretabhead + i;
		if(Number(currid) == i)
		{
			document.getElementById(contid).style.display = "block";
			document.getElementById(tabid).className = "linktabon";
		}
		else
		{
			document.getElementById(contid).style.display = "none";
			document.getElementById(tabid).className = "linktaboff";
		}
	}
}

function switchtab_new(currid)
{
	var total = 5;
	var pretabcont = "tabcont";
	var pretabhead = "tab";
	for(i=1;i<=total;i++)
	{
		var contid = pretabcont + i;
		var tabid = pretabhead + i;
		if(Number(currid) == i)
		{
			document.getElementById(contid).style.display = "block";
			document.getElementById(tabid).className = "linktabon1";
		}
		else
		{
			document.getElementById(contid).style.display = "none";
			document.getElementById(tabid).className = "linktaboff1";
		}
	}
}

function switchtab3(currid)
{
	var total = 3;
	var pretabcont = "tabcont";
	var pretabhead = "tab";
	for(i=1;i<=total;i++)
	{
		var contid = pretabcont + i;
		var tabid = pretabhead + i;
		if(Number(currid) == i)
		{
			document.getElementById(contid).style.display = "block";
			document.getElementById(tabid).className = "linktabon1";
		}
		else
		{
			document.getElementById(contid).style.display = "none";
			document.getElementById(tabid).className = "linktaboff1";
		}
	}
}

function validateTransferMoneyForm(fname,email,homeNo1,homeNo2,homeNo3,country,regForm)
{
	initialize_error_msgs();

	validate_mandatory_tb_with_message(fname, "Please enter your First Name");
 	validate_textbox_space_with_msg(fname,"First Name ");
	validate_special_char(fname,"First Name ");

	if(fname.value.toLowerCase() == "first name" || fname.value.toLowerCase() == "last name")
	{
		printMsg("Please enter valid text");
	}


	validate_email_value(email);

	validate_mandatory_tb_with_message(homeNo1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo1," Country Code");
	validate_numeric_value_with_msg(homeNo1,"Country Code ");

	validate_mandatory_tb_with_message(homeNo2, "Area Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo2,"Area Code");
	validate_numeric_value_with_msg(homeNo2,"Area Code");

	validate_mandatory_tb_with_message(homeNo3, "Telephone No of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo3,"Home Phone");
	validate_numeric_value_with_msg(homeNo3,"Home Phone");

	if(country.value == "")
	{
		printMsg("Please select Country");
	}

	return check_display_errors(regForm);
}


function validateRemitCardForm(fname,email,homeNo1,homeNo2,homeNo3,regForm)
{
	initialize_error_msgs();

	validate_mandatory_tb_with_message(fname, "Please enter your First Name");
 	validate_textbox_space_with_msg(fname,"First Name ");
	validate_special_char(fname,"First Name ");
	


	if(fname.value.toLowerCase() == "first name" || fname.value.toLowerCase() == "last name")
	{
		printMsg("Please enter valid text");
	}
	validate_email_value(email);

	validate_mandatory_tb_with_message(homeNo1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo1," Country Code");
	validate_numeric_value_with_msg(homeNo1,"Country Code ");

	validate_mandatory_tb_with_message(homeNo2, "Area Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo2,"Area Code");
	validate_numeric_value_with_msg(homeNo2,"Area Code");

	validate_mandatory_tb_with_message(homeNo3, "Telephone No of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo3,"Home Phone");
	validate_numeric_value_with_msg(homeNo3,"Home Phone");	

	return check_display_errors(regForm);
}

function validateAirtel(fname,email,homeNo1,homeNo2,homeNo3,country,regForm)
{
	initialize_error_msgs();

	validate_mandatory_tb_with_message(fname, "Please enter your First Name");
 	validate_textbox_space_with_msg(fname,"First Name ");
	validate_special_char(fname,"First Name ");
	


	if(fname.value.toLowerCase() == "first name")
	{
		printMsg("Please enter valid text");
	}
	validate_email_value(email);

	validate_mandatory_tb_with_message(homeNo1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo1," Country Code");
	validate_numeric_value_with_msg(homeNo1,"Country Code ");

	validate_mandatory_tb_with_message(homeNo2, "Area Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo2,"Area Code");
	validate_numeric_value_with_msg(homeNo2,"Area Code");

	validate_mandatory_tb_with_message(homeNo3, "Telephone No of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo3,"Home Phone");
	validate_numeric_value_with_msg(homeNo3,"Home Phone");	

	if(country.value == "")
	{
		printMsg("Please select Country");
	}

	return check_display_errors(regForm);
}

function validateNDTV(fname,email,homeNo1,homeNo2,homeNo3,country,mob1,mobileNo,tnc,regForm)
{
	initialize_error_msgs();

	validate_mandatory_tb_with_message(fname, "Please enter your First Name");
 	validate_textbox_space_with_msg(fname,"First Name ");
	validate_special_char(fname,"First Name ");
	


	if(fname.value.toLowerCase() == "first name")
	{
		printMsg("Please enter valid text");
	}
	validate_email_value(email);

	validate_mandatory_tb_with_message(homeNo1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo1," Country Code");
	validate_numeric_value_with_msg(homeNo1,"Country Code ");

	validate_mandatory_tb_with_message(homeNo2, "Area Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo2,"Area Code");
	validate_numeric_value_with_msg(homeNo2,"Area Code");

	validate_mandatory_tb_with_message(homeNo3, "Telephone No of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo3,"Home Phone");
	validate_numeric_value_with_msg(homeNo3,"Home Phone");	

	validate_mandatory_tb_with_message(mob1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(mob1," Country Code");
	validate_numeric_value_with_msg(mob1,"Country Code ");

	validate_mandatory_tb_with_message(mobileNo, "Mobile number cannot be left blank");
	validate_textbox_space_with_msg(mobileNo,"Mobile number");
	validate_numeric_value_with_msg(mobileNo,"Mobile number");

	if(country.value == "")
	{
		printMsg("Please select Country");
	}
	if (tnc.checked == false)
	{
		printMsg("Please select Terms and condition");
	}

	return check_display_errors(regForm);
}

/**
 * Javascript to blink text.
 * will blink the text which comes inside <blink> </blink> tags
 *
 * Aneesh N :: 7-Dec-2009 
*/
function doBlink()
{
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink()
{
  // Make sure it is IE4
  if (document.all)
    setInterval("doBlink()",1000)
}
window.onload = startBlink;

function validateCarNCash(fname,email,homeNo1,homeNo2,homeNo3,country,mob1,mobileNo,tnc,regForm)
{
	initialize_error_msgs();

	validate_mandatory_tb_with_message(fname, "Please enter your First Name");
 	validate_textbox_space_with_msg(fname,"First Name ");
	validate_special_char(fname,"First Name ");
	


	if(fname.value.toLowerCase() == "first name")
	{
		printMsg("Please enter valid text");
	}
	validate_email_value(email);

	validate_mandatory_tb_with_message(homeNo1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo1," Country Code");
	validate_numeric_value_with_msg(homeNo1,"Country Code ");

	validate_mandatory_tb_with_message(homeNo2, "Area Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo2,"Area Code");
	validate_numeric_value_with_msg(homeNo2,"Area Code");

	validate_mandatory_tb_with_message(homeNo3, "Telephone No of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(homeNo3,"Home Phone");
	validate_numeric_value_with_msg(homeNo3,"Home Phone");	

	validate_mandatory_tb_with_message(mob1, "Country Code of Day-time Phone cannot be left blank");
	validate_textbox_space_with_msg(mob1," Country Code");
	validate_numeric_value_with_msg(mob1,"Country Code ");

	validate_mandatory_tb_with_message(mobileNo, "Mobile number cannot be left blank");
	validate_textbox_space_with_msg(mobileNo,"Mobile number");
	validate_numeric_value_with_msg(mobileNo,"Mobile number");

	if(mobileNo.value != "")
	{
		if((mobileNo.value.length) < 10)
		{
			printMsg("Length of Mobile No has to be 10 digits");
		}
	}


	if(country.value == "")
	{
		printMsg("Please select Country");
	}
	if (tnc.checked == false)
	{
		printMsg("Please select Terms and condition");
	}

	return check_display_errors(regForm);
}