// JavaScript Document
<!--
// resource strings
var searchMessage = "KeyWord must be between 4 and 255 char.";

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function P7_Snap() { //v2.63 by PVII
 var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}
/**
function HideAll(){
MM_showHideLayers('HideAll','','hide','SubMenu1','','hide','SubMenu2','','hide','SubMenu3','','hide','SubMenu4','','hide','SubMenu5','','hide','SubMenu6','','hide','SubMenu7','','hide','SubMenu8','','hide','SubMenu9','','hide','SubMenu10','','hide')
}
*/
var SubMenuNumber=10;
var SubMenuArray=new Array ();
function FillArray() {
for (j=1 ; j<=SubMenuNumber;j++)
	{
		SubMenuArray[j]='SubMenu'+j;
	}
}
function HideAll(mm){
  
	MM_showHideLayers('HideAll','','hide');	
	HideAll2(mm);
}
function HideAll1(mm1){
  
	MM_showHideLayers('HideAll1','','hide');	
	HideAll2(mm1);
	
}
function HideApplication(mm1){
  
	MM_showHideLayers('HideApplication','','hide');	
	HideAll2(mm1);
	
}
function HideAllImp(mm2){
  
	MM_showHideLayers('HideAllImp','','hide');	
	HideAll2(mm2);
	
	
	
}
function HideAllImp2(mm3){
  
	MM_showHideLayers('HideAllImp','','hide');	
	HideAll2(mm3);
	
	
	
}
function HideAllImp3(mm4){
  
	MM_showHideLayers('HideAllImp','','hide');	
	HideAll2(mm4);
	
	
	
}
function HideAll2(mm)
{  

	var id = mm.split(","); 
	for (i = 0; i < id.length; i++)
	{
		MM_showHideLayers(id[i],'','hide');
		
	}
	
}

function HideAll3(){
	for (j=1 ; j<SubMenuArray.length;j++)
	{
		MM_showHideLayers(SubMenuArray[j],'','hide')
	}
}
/**/
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


var className = "";
var classID = "";
function changeclass(LienId,LienName){
	var Sub = document.getElementById (LienId);
		if(Sub.className == LienName){
			Sub.className= LienName+"on";
			if (classID != "") changeclass(LienId,LienName);
			classID = LienId;
			className = LienName;
		}
		else
		{
			Sub.className= LienName;
			classID = "";
			className = LienName;
		}
	}
var CurrentNews = 1;
var MaxNews = 2;
function NextNews()
{
	if(document.getElementById('news'+(CurrentNews+1)))
	{
		for (i=1; i<=MaxNews; i++)	{
			document.getElementById('news'+i).style.display = "none";
		}			
		document.getElementById('news'+(CurrentNews+1)).style.display = "";
	}
	CurrentNews++;
	if (CurrentNews == MaxNews)
		CurrentNews = 0;
}
function RunDIV()
{
	setInterval('NextNews()', 3000);
}
function validApplication(){	
if (document.Form1.cardlimit.value == "")
	{
		alert("Please enter a value for the selected field.");
		document.Form1.cardlimit.focus();
		return;
	}
	else 
	if (document.Form1.title.value == "")
		{
			alert("Please enter a value for the selected field.");
			document.Form1.title.focus();
			return;
		}
		else 
		if (document.Form1.fistname.value == "")
			{
				alert("Please enter a value for the selected field.");
				document.Form1.fistname.focus();
				return;
			}
		else 
		if (document.Form1.middlename.value == "")
			{
				alert("Please enter a value for the selected field.");
				document.Form1.middlename.focus();
				return;
			}
		else 
		if (document.Form1.familyname.value == "")
			{
				alert("Please enter a value for the selected field.");
				document.Form1.familyname.focus();
				return;
			}
		else
			document.Form1.submit();
	

}
/*
var PanelSlideOut1 = "";
function revelerCacherSousNav1(LienId){
var Sub = document.getElementById (LienId+"_sub");
	if(Sub.style.display == "none"){
		document.getElementById (LienId).style.color="#0b8d0b";
		Sub.style.display = "";
		if (PanelSlideOut1 != "") revelerCacherSousNav1(PanelSlideOut1);
		PanelSlideOut1 = LienId;
	}
	else
	{
		document.getElementById (LienId).style.color="";
		Sub.style.display = "none";
		PanelSlideOut1 = "";
	}
}
*/
/*
var PanelSlideOut1 	= "";
var ClassName1 		= "";
var IdNextTD1 		= "";
var ClassNextTD1 	= "";
function revelerCacherSousNav1(LienId,ClassName,IdNextTD,ClassNextTD){
var Sub = document.getElementById (LienId+"_sub");
	if(Sub.style.display == "none"){
		document.getElementById(LienId).style.color="#0b8d0b";
		document.getElementById (LienId).className=ClassName+"on";
		document.getElementById (IdNextTD).className=ClassNextTD;
		
		Sub.style.display = "";
		if (PanelSlideOut1 != "") 
			revelerCacherSousNav1(PanelSlideOut1,ClassName1,IdNextTD1,ClassNextTD1);
		PanelSlideOut1	= LienId;
		ClassName1		= ClassName;
		IdNextTD1		= IdNextTD;
		ClassNextTD1	= ClassNextTD;
	}
	else
	{
		document.getElementById(LienId).style.color="";
		document.getElementById (LienId).className=ClassName;
		document.getElementById (IdNextTD).className=ClassNextTD+"out";
		Sub.style.display = "none";
		PanelSlideOut1	= "";
		ClassName1		= "";
		IdNextTD1		= "";
		ClassNextTD1	= "";
	}
}
var PanelSlideOut2 	= "";
var ClassName2 		= "";
var IdNextTD2 		= "";
var ClassNextTD2 	= "";
function revelerCacherSousNav2(LienId,ClassName,IdNextTD,ClassNextTD){
var Sub = document.getElementById (LienId+"_sub");
	if(Sub.style.display == "none"){
		document.getElementById(LienId).style.color="#0b8d0b";
		document.getElementById (LienId).className=ClassName+"on";
		document.getElementById (IdNextTD).className=ClassNextTD;
		
		Sub.style.display = "";
		if (PanelSlideOut2 != "") 
			revelerCacherSousNav2(PanelSlideOut2,ClassName2,IdNextTD2,ClassNextTD2);
		PanelSlideOut2	= LienId;
		ClassName2		= ClassName;
		IdNextTD2		= IdNextTD;
		ClassNextTD2	= ClassNextTD;
	}
	else
	{
		document.getElementById(LienId).style.color="";
		document.getElementById (LienId).className=ClassName;
		document.getElementById (IdNextTD).className=ClassNextTD+"out";
		Sub.style.display = "none";
		PanelSlideOut2	= "";
		ClassName2		= "";
		IdNextTD2		= "";
		ClassNextTD2	= "";
	}
}
*/
var PanelSlideOut1 	= "";
var ClassName1 		= "";
var IdNextTD1 		= "";
var ClassNextTD1 	= "";
function revelerCacherSousNav1(LienId,ClassName,IdNextTD,ClassNextTD){
var Sub = document.getElementById (LienId+"_sub");
	if(Sub.style.display == "none"){
		document.getElementById(LienId).style.color="#0b8d0b";
		document.getElementById (LienId).className=ClassName+"on";
		document.getElementById (IdNextTD).className=ClassNextTD;
		
		Sub.style.display = "";
		if (PanelSlideOut1 != "") 
			revelerCacherSousNav1(PanelSlideOut1,ClassName1,IdNextTD1,ClassNextTD1);
		PanelSlideOut1	= LienId;
		ClassName1		= ClassName;
		IdNextTD1		= IdNextTD;
		ClassNextTD1	= ClassNextTD;
	}
	else
	{
		document.getElementById(LienId).style.color="";
		document.getElementById (LienId).className=ClassName;
		document.getElementById (IdNextTD).className=ClassNextTD+"out";
		Sub.style.display = "none";
		PanelSlideOut1	= "";
		ClassName1		= "";
		IdNextTD1		= "";
		ClassNextTD1	= "";
	}
}
var PanelSlideOut2 	= "";
var ClassName2 		= "";
var IdNextTD2 		= "";
var ClassNextTD2 	= "";
function revelerCacherSousNav2(LienId,ClassName,IdNextTD,ClassNextTD){
var Sub = document.getElementById (LienId+"_sub");
	if(Sub.style.display == "none"){
		document.getElementById(LienId).style.color="#0b8d0b";
		document.getElementById (LienId).className=ClassName+"on";
		document.getElementById (IdNextTD).className=ClassNextTD;
		
		Sub.style.display = "";
		if (PanelSlideOut2 != "") 
			revelerCacherSousNav2(PanelSlideOut2,ClassName2,IdNextTD2,ClassNextTD2);
		PanelSlideOut2	= LienId;
		ClassName2		= ClassName;
		IdNextTD2		= IdNextTD;
		ClassNextTD2	= ClassNextTD;
	}
	else
	{
		document.getElementById(LienId).style.color="";
		document.getElementById (LienId).className=ClassName;
		document.getElementById (IdNextTD).className=ClassNextTD+"out";
		Sub.style.display = "none";
		PanelSlideOut2	= "";
		ClassName2		= "";
		IdNextTD2		= "";
		ClassNextTD2	= "";
	}
}
function submitform() {
loop=document.Form1.Text6.selectedIndex;
id = document.Form1.Text6.options[loop].value;
loop1=document.Form1.Text7.selectedIndex;
id1= document.Form1.Text7.options[loop1].value;
var str = document.Form1.Text3.value;
var filter =/^.+@.+\..{2,3}$/;
if (document.Form1.Text1.value == ""){
	alert('Please enter your first name!');
	document.Form1.Text1.focus();
	}
else if (document.Form1.Text2.value == ""){
	alert('Please enter your last name!');
	document.Form1.Text2.focus();}
else if ( str == "" || !filter.test(str) ){ 
	alert('Please enter a valid email address!');
	document.Form1.Text3.focus();
	}
else if (id==0){
	alert('Please enter your gender!');
	document.Form1.Text6.focus();
	}
else if (id1==0){
	alert('Please enter your country!');
	document.Form1.Text7.focus();}
else
{
	document.Form1.submit();
} 
}
function resetform(){
	document.Form1.reset();
	}
	
/*calculators functions*/
function checkNum(input) {
	var oldnum;
	var newnum;
	var ch;
	oldnum = input.value;
	newnum ="";
	for(var i=0; i<oldnum.length; i++) {
		ch = oldnum.charAt(i);
		if(ch != ",") {
			newnum += ch;
		}
	}
	return parseFloat(newnum);
}
function checkNumPeriods(input,plus) {
	  input.value = checkNum(input);
        input.value = parseInt(input.value);
        if(input.value == null || input.value.length == 0 || input.value == "NaN") {
                input.value = "";
        }
        else {
                if(parseFloat(input.value) <= 0) {
                        input.value = "";
                }
        }
		if(plus==1)
        	calcMonthlyplus(input.form);
			else if(plus==2)
				calcMonthly2(input.form);
				else
					calcMonthly(input.form);
		input.value = put_commas(input.value);
}
function strip_commas(input) {
        var newnum;
        var ch;
        newnum ="";
        for(var i=0; i<input.length; i++) {
                ch = input.charAt(i);
                if(ch != ",") {
                        newnum += ch;
                }
        }
        return parseFloat(newnum);
}
function put_commas(input) {
    var result, len;
    input += "";
    len = input.indexOf(".");
    if(len == -1) {
        len = input.length;
        result = "";
    }
    else {
        result = input.substring(len, input.length);
    }
    while(len > 3) {
        result = input.substring(len-3, len) + result;
        result = "," + result;
        len -= 3;
    }
    result = input.substring(0, len) + result;
    return result;
}
function checkLoan(input,plus) {
	  input.value = checkNum(input);
        input.value = parseFloat(input.value);
        if(input.value == null || input.value.length == 0 || input.value == "NaN") {
                input.value = "";
        }
        else {
                if(parseFloat(input.value) < 0) {
                        input.value = "";
                }
        }
        if(plus==1)
        	calcMonthlyplus(input.form);
			else if(plus==2)
				calcMonthly2(input.form);
				else
					calcMonthly(input.form);
		input.value = put_commas(input.value);
}
function checkInterest(input,plus) {
        input.value = parseFloat(input.value);
        if(input.value == null || input.value.length == 0 || input.value == "NaN") {
                input.value = "";
			}
        else {
                if(parseFloat(input.value) <= 0 || parseFloat(input.value) > 100.0) {
                        input.value = "";
                }
        }
        if(plus==1)
        	calcMonthlyplus(input.form);
			else if(plus==2)
				calcMonthly2(input.form);
				else
					calcMonthly(input.form);
}
function calcMonthlyplus(input) {
        if(input.interest.value == "" || input.nper.value == "" || input.loan.value == "" ) {
                input.monthly.value = "";
        }
        else {
                i = strip_commas(input.interest.value) / 100;
                i = i / 12;
                n = strip_commas(input.nper.value) * 12;
                tmp = (1/i) * (1 - Math.pow(1/(1+i), n));
                tmp = strip_commas(input.loan.value) / tmp;
                tmp = Math.round(tmp*100) / 100;
				input.total.value = put_commas(Math.round(12 *(tmp * input.nper.value)))
				input.monthly.value = put_commas(Math.round(tmp));
                if(input.monthly.value == null || input.monthly.value.length == 0 || input.monthly.value == "NaN") {
                        input.monthly.value = "";
                }
        }
}
function calcMonthly(input) {
        if(input.interest.value == "" || input.nper.value == "" || input.loan.value == "" ) {
                input.monthly.value = "";
        }
        else {
                i = strip_commas(input.interest.value) / 100;
                i = i / 12;
                n = strip_commas(input.nper.value); //* 12
                tmp = (1 - Math.pow(1/(1+i), n));
                tmp = strip_commas(input.loan.value) * i/ tmp;
                tmp = Math.round(tmp*100) / 100;
				   input.total.value = put_commas(Math.round((tmp * input.nper.value)))
				   input.monthly.value = put_commas(Math.round(tmp));
         		  if(input.monthly.value == null || input.monthly.value.length == 0 ||  input.monthly.value == "NaN") {
                       input.monthly.value = "";
                }
        }
}
function calcMonthly2(input) {
        if(input.interest.value == "" || input.nper.value == "" || input.loan.value == "" ) {
                input.monthly.value = "";
        }
        else {
                i = strip_commas(input.interest.value) / 100;
                i = i / 12;
                n = strip_commas(input.nper.value) * 12;
                tmp = (1 - Math.pow(1/(1+i), n));
                tmp = strip_commas(input.loan.value) * i/ tmp;
                tmp = Math.round(tmp*100) / 100;
				   input.total.value = put_commas(Math.round(12 *(tmp * input.nper.value)))
				   input.monthly.value = put_commas(Math.round(tmp));
         		  if(input.monthly.value == null || input.monthly.value.length == 0 || input.monthly.value == "NaN") {
                       input.monthly.value = "";
                }
        }
}
function IfEnter(e)
{
	if (e.keyCode == 13) 
	{
		return GoogleSearch();
	}
}
function GoogleSearch()
{
	var str = document.getElementById ('searchTextBox').value;
	if (str.length < 4 || str.length > 255)
	{
		alert(searchMessage);
		document.Form1.search.focus();
		document.Form1.search.select();
		return (false);
	}
	else
	{
		var spaceCharacter = / /g;
		window.location = "/Youth/SearchResults.htm?hl=en&q=" + str.replace(spaceCharacter, "+");
		return false;
	}
}
function ResizeBrowser(){
	document.getElementById('rightMenuId').height=screen.height - 209;
}
function trim(str)
{
	return str.replace(/ /g,"");
}
function validContactUsForm()
{
	if (trim (document.Form1.txtFirstName.value) == '')
	{
		alert ('First Name is required');
		document.Form1.txtFirstName.focus();
		return false;
	}
	
	if (trim (document.Form1.txtLastName.value) == '')
	{
		alert ('Last Name is required');
		document.Form1.txtLastName.focus();
		return false;
	}
	
	if (document.Form1.ddlGender.value == 0)
	{
		alert ('Gender is required');
		document.Form1.ddlGender.focus();
		return false;
	}
	if (document.Form1.ddlCountry.value == 0)
	{
		alert ('Country is required');
		document.Form1.ddlCountry.focus();
		return false;
	}
	
	if (trim (document.Form1.txtEmail.value) == '')
	{
		alert ('Email is required');
		document.Form1.txtEmail.focus();
		return false;
	}
	if (document.Form1.txtEmail.value.indexOf ('@', 0) == -1 || document.Form1.txtEmail.value.indexOf ('.', 0) == -1) 
	{
		alert('Please enter a valid Email.');
		document.Form1.txtEmail.focus();
		return false;
	}
	
	if (trim (document.Form1.txtComment.value) == '')
	{
		alert ('Comments are required');
		document.Form1.txtComment.focus();
		return false;
	}
	
}
function validateGetInvolvedForm ()
{
	if (trim (document.Form1.txtName.value) == '')
	{
		document.getElementById('valName').style.display = '';
		document.Form1.txtName.focus();
		return false;
	}
	else
		document.getElementById('valName').style.display = 'none';
	
	if (trim (document.Form1.txtPhone.value) == '')
	{
		document.getElementById('valPhone').style.display = '';
		document.Form1.txtPhone.focus();
		return false;
	}
	else
		document.getElementById('valPhone').style.display = 'none';
		
	if (trim (document.Form1.txtEmail.value) == '')
	{
		document.getElementById('valEmail').style.display = '';
		document.Form1.txtEmail.focus();
		return false;
	}
	else
		document.getElementById('valEmail').style.display = 'none';
		
	if (document.Form1.txtEmail.value.indexOf ('@', 0) == -1 || document.Form1.txtEmail.value.indexOf ('.', 0) == -1) 
	{
		document.getElementById('valEmail').style.display = '';
		alert('Please enter a valid Email.');
		document.Form1.txtEmail.focus();
		return false;
	}
	else
		document.getElementById('valEmail').style.display = 'none';
}
function getQueryVariable(variable) 
{  
	var query = window.location.search.substring(1);  
	var vars = query.split("&");  
	for (var i=0;i<vars.length;i++) 
	{
		var pair = vars[i].split("=");
		if (pair[0] == variable) 
		{
			return pair[1];
		}
	}
}
-->
