function _getElementById(id){
	var item = null;
	
	if (document.getElementById){
		item = document.getElementById(id);
	} else if (document.all){
		item = document.all[id];
	} else if (document.layers){
		item = document.layers[id];
	}

return item;
}

function _getElementByTag(tag){
	var item = null;
	item = document.getElementsByTagName(tag);
	
	return item;
}

function Show2(id)
{ //alert(document.getElementById('co_applicant_f').value);
	if (document.getElementById('co_applicant_f').value=='yes')
	{ Show('co_applicant');
		}
	if (document.getElementById('co_applicant_f').value=='No')
	{ Hide('co_applicant');
		}
}
function Show(id) {
	var item = _getElementById(id);
	item.style.display = '';
	item.visibility = 'show';
}

function Hide(id) {
	var item = _getElementById(id);
	item.style.display = 'none';
}

function checkSubmit(){
	var s = document.getElementById('type_of_loan');
	var b=document.getElementById('amount');
	var n=document.getElementById('creditProfile');
	var d=document.getElementById('creditProfile');
	var url = '';
	ret=true;
	s.style.backgroundColor='';
	b.style.backgroundColor='';
	mess="";
	mess2="";
	mess3="";
	if(s.selectedIndex == 0){
		//alert('Please Select Loan Type');
		s.style.backgroundColor='#ffa5a5';
		mess='Type of Loan';
		ret=false;
	//	document.forms[0].action = url;
		} 
		if (b.selectedIndex == 0){
		b.style.backgroundColor='#ffa5a5';
		mess2=',Loan Amount';
		ret=false;}
		if (n.selectedIndex == 0)
		{
		n.style.backgroundColor='#ffa5a5';
		mess3=',Your Credit Profile';
		ret=false;}
		if (!ret) {alert("Please Select:" + mess+' '+mess2+' '+mess3);
		return ret;
		} 
		else {
	if(s.selectedIndex == 1){url = 'http://www.getmyquote.ca/mortgages/mortgage-form.php?'}
	//if(s.selectedIndex == 2){url = 'http://www.getmyquote.ca/mortgage/refinance-mortgage.html?'}
	if(s.selectedIndex == 2){url = 'http://www.getmyquote.ca/mortgage-refinance/mortgage-refinance-form.php?'}
	//if(s.selectedIndex == 3){url = 'http://www.getmyquote.ca/loan/home-equity.html?'}
	//if(s.selectedIndex == 4){url = 'http://www.getmyquote.ca/loan/debt-consolidation.html?'}
	
	document.forms[0].action = url+'amount='+b.selectedIndex+'&'+'creditProfile='+d.selectedIndex;
	
	document.forms[0].submit();
}
 }
 
 