/*location page code*/
function displayGo(){
var input = document.getElementById("lnSbmtBut");
var newInput = document.createElement('input');
newInput.type = 'submit';
newInput.name = input.name
newInput.id='lnSbmtBut';
newInput.tabIndex='2';
newInput.value = newInput.defaultValue = input.value;
newInput.onclick =function doThis1(){return getOtherDetailsForLoanAmount()};
newInput.className='loanGobut';
input.parentNode.replaceChild(newInput, input);	
}

function goToLocation()
{
 var goToPage = document.getElementById('cmbCity').value;
  if (goToPage == 'newcars-whitefield')
	{ window.location='../newcars-whitefield.htm' ;	}
  if (goToPage == 'newcars-oldairport')
	{ window.location='../newcars-oldairport.htm' ;	}
  if (goToPage == 'workshop-whitefield')
	{ window.location='../workshop-whitefield.htm' ;	}
  if (goToPage == 'workshop-indiranagar')
	{ window.location='../workshop-indiranagar.htm' ;	}
  if (goToPage == 'workshop-kanakapura')
	{ window.location='../workshop-kanakapura.htm' ;	}
  if (goToPage == 'workshop-bannerghatta')
	{ window.location='../workshop-bannerghatta.htm' ;	}
	if (goToPage == 'newcars-yelahanka')
	{ window.location='../newcars-yelahanka.htm' ;	}
  if (goToPage == 'workshop-yelahanka')
	{ window.location='../workshop-yelahanka.htm' ;	}
  if (goToPage == 'truevalue-outer-ringroad')
	{ window.location='../truevalue-outer-ringroad.htm' ;	}
  if (goToPage == 'marutidrivingschool')
	{ window.location='../marutidrivingschool.htm' ;	}
  }

function chkEligible()
{
document.frmselfemp.action = "eligible.htm";
}
function chkCorporate()
{
document.frmselfemp.action = "eligible-corporate.htm";
}
function chkSelfEmp()
{
document.frmselfemp.action = "eligible-self-employed.htm";
}
function chkLoanEmi()
{
document.frmselfemp.action = "loanemi.htm";
}
function chkFinForm()
{
document.frmselfemp.action = "finance.htm";
}

function goToFinance(goToPage)
{
 var thisPage = goToPage; 
 alert(goToPage);
  alert(window.location);
  if (goToPage == 'salaryEligible'){window.location='eligible.htm';}  
  if (goToPage == 'salaryCorporate'){window.location='../eligible-corporate.htm'}
  if (goToPage == 'salarySelfEmployed'){window.location='../eligible-self-employed.htm'}
  if (goToPage == 'loanemi'){window.location='../loanemi.htm'}
  if (goToPage == 'finance'){window.location='../finance.htm'}
  
}


function selectInstype(val) {
	if(val =="New"){
		showhidedivs("none");
	}else{
		showhidedivs("block");
	}
}

function showForm(formName) {
	
	if(formName=="loanForm"){
	var input = document.getElementById("lnSbmtBut");
	var newInput = document.createElement('input');
	newInput.type = 'button';
	newInput.id='lnSbmtBut';
	input.parentNode.replaceChild(newInput, input);		
	document.getElementById("estimatColm").style.display = "none";
	setPosition();
	}else if(formName=="accessoriesForm"){
		setPosition();
	}
}
function setPosition(){
	var posL = document.getElementById("innerMain").offsetLeft;
	var posT = document.getElementById("innerMain").offsetTop + 25; 

	document.getElementById("leadForm").style.display = "block";
	document.getElementById("formBox").style.display = "block";
	
	document.getElementById("leadForm").style.filter = 'alpha(opacity=70)';
	document.getElementById("leadForm").style.opacity = 0.7;

	document.getElementById("leadForm").style.left = posL +"px";
	document.getElementById("leadForm").style.top = posT +"px";
	
	document.getElementById("formBox").style.left = (posL + 30) +"px";
	document.getElementById("formBox").style.top = (posT+14) +"px";	
}
function hideDiv(formName,divname) {
	if(divname=="deal"){
		if(formName=="loanForm"){
			document.getElementById("estimatColm").style.display = "block";
			document.getElementById("leadForm").style.display = "none";
			document.getElementById("formBox").style.display = "none";
			displayGo();
		}else if(formName=="accessoriesForm"){
			document.getElementById("leadForm").style.display = "none";
			document.getElementById("formBox").style.display = "none";			
		}
	}
	else if(divname=="disc") {
		document.getElementById("disclaimDiv").style.display = "none";
		document.getElementById("ttldiv").style.display = "block";
		document.getElementById("methdiv").style.display = "block";
		document.getElementById("timediv").style.display = "block";		
	}
}

function showDisclaimer() {
	var posL = document.getElementById("formBox").offsetLeft + 137;
	var posT = document.getElementById("formBox").offsetTop + 10; 	
	document.getElementById("disclaimDiv").style.display = "block";
	document.getElementById("ttldiv").style.display = "none";
	document.getElementById("methdiv").style.display = "none";
	document.getElementById("timediv").style.display = "none";

	document.getElementById("disclaimDiv").style.left = posL +"px";
	document.getElementById("disclaimDiv").style.top = posT +"px";
}

function showhidedivs(flag) {
	document.getElementById("inscomp").style.display = flag;
	document.getElementById("inspol").style.display = flag;
	document.getElementById("insexdt").style.display = flag;
	document.getElementById("inscur").style.display = flag;
	document.getElementById("insvlue").style.display = flag;
}

function alignaccGrid(n) {
	var totalRows = n;
	var rowWidth = 0;
	for(var i=0;i<totalRows;i++) {
		var curRow = "accRow"+i;
		var rowHeight = parseInt(document.getElementById(curRow).offsetHeight);
		var parantDiv = document.getElementById(curRow);
		var children = parantDiv.getElementsByTagName("div");
		for(var j=0;j<children.length;j++) {
			var alt = j%2;
			if(alt==0) {
				children[j].style.height = rowHeight+"px";
			}
		}
	}
	if((document.getElementById("admOverflow").offsetHeight) >= 211){
		rowWidth = 894;
	}
	else {
		rowWidth = 911;
	}
	for(var i=0;i<totalRows;i++) {
		var curRow = "accRow"+i;
		document.getElementById(curRow).style.width = rowWidth+"px";
	}
}

//Used cars
/*var currentPan = "pan1";
var curButn = "";
function showHidePanel(n,flag){
	var panId = "pan"+n;
	var panObj = document.getElementById(panId);
	var butObj = document.getElementById(n);
	var butName = document.getElementById(n).name;
	var divPos = document.getElementById("contPan").offsetTop;
	if(flag){
		panObj.style.display = "none";
		butObj.style.backgroundImage = "url(../images/usedcars/"+butName+".jpg)";
		curButn = "";
	} else {
		butObj.style.backgroundImage = "url(../images/usedcars/"+butName+"_mo.jpg)";
		panObj.style.display = "block";
		panObj.style.top = divPos+"px";
		if(panId != currentPan && curButn !=""){
			document.getElementById(currentPan).style.display = "none";
			document.getElementsByName(curButn)[0].style.backgroundImage = "url(../images/usedcars/"+curButn+".jpg)";
		}	
		curButn = butName;
	}	
	currentPan = panId;
}*/
var currentPan = "panA";
var curButn = "";
function showHidePanel(n,flag){
	var panId = "pan"+n;
	var panObj = document.getElementById(panId);
	var butObj = document.getElementById(n);
	var butName = document.getElementById(n).name;
	var divPos = document.getElementById("contPan").offsetTop;
	if(flag){
		panObj.style.display = "none";
		butObj.style.backgroundImage = "url(../images/usedcars/"+butName+".jpg)";
		curButn = "";
	} else {
		butObj.style.backgroundImage = "url(../images/usedcars/"+butName+"_mo.jpg)";
		panObj.style.display = "block";
		panObj.style.top = divPos+"px";
		if(panId != currentPan && curButn !=""){
			document.getElementById(currentPan).style.display = "none";
			document.getElementsByName(curButn)[0].style.backgroundImage = "url(../images/usedcars/"+curButn+".jpg)";
		}	
		curButn = butName;
	}	
	currentPan = panId;
}
function toggleButton(obj,n) {
	butName = obj.name;
	if(n==1){
		obj.style.backgroundImage = "url(../images/usedcars/"+butName+"_mo.jpg)";
	}else{
		if(butName != curButn)
		obj.style.backgroundImage = "url(../images/usedcars/"+butName+".jpg)";
	}
}