// JavaScript Document
<!--
var selSection = new Array();
var activeSinkEl,activeAppEl;

function setSelectedSection(l, m, r){
	selSection[0] = l;
	selSection[1] = m;
	selSection[2] = r;
}

function showHideSink(chk,panel,sink,txtSD){
	//var showInfoPanel;
	//var sinkLayer;
	//var appLayer;
	//var formLayer;
	//var stoveType;
	//var chkBox;
	var chkBox = document.getElementById(chk);
	var showInfoPanel = document.getElementById(panel);
	var objPanelLayer = document.getElementById(txtSD);
	var sinkLayer = document.getElementById(sink);
	
	//alert(objPanelLayer.id);
	//alert(sinkLayer.id);
	/*
	if(sink=='top_Stove'){
		stoveType = document.forms.quoteForm.ddlStoveTypesMid.value;
		window.status = stoveType;
		switch(stoveType){
			case 1:
				sinkLayer = document.getElementById(sink);
	
			
	} 
	*/
	if(chkBox.checked){
		showInfoPanel.style.display = 'block';
		sinkLayer.style.display = 'block';
		objPanelLayer.style.display = 'block';
	}else{
		showInfoPanel.style.display = 'none';
		sinkLayer.style.display = 'none';
		objPanelLayer.style.display = 'none';
	}
	window.status = objPanelLayer.id;
	chkBox.blur();
}



function resetSinkSize(chk,cLen,cPos,txtLen,txtPos,txtShowDims){
	window.status = 'chk:' + chk.checked + '   cLen:' + cLen + '   cPos:' + cPos + '   txtShowDims:' + txtShowDims;
	var sLen;
	var sPos;
	var txLen;
	var txPos;
	//appLayer = document.getElementById(app);
	//if(sinkLayer=='left_Sink')
		sLen = document.getElementById(txtLen);
		sPos = document.getElementById(txtPos);
		txLen = document.getElementById(cLen);
		txPos = document.getElementById(cPos);
		if(chk.checked){
			sLen.value = '30';
			sPos.value = '0';
			txLen.value = '30';
			txPos.value = '0';
			//sLen.style.background = '#F1E9CF';
			//sLen.style.borderColor = '#DAC278';
			//sPos.style.background = '#F1E9CF';
			//sPos.style.borderColor = '#DAC278';
			//document.getElementById(txtShowLen).style.display = 'block';
			//document.getElementById(txtShowPos).style.display = 'block';
		} else {
			sLen.value = '';
			sPos.value = '';
			txLen.value = '0';
			txPos.value = '0';
			//sLen.style.background = '#bbbbbb';
			//sLen.style.borderColor = '#999999';
			//sPos.style.background = '#bbbbbb';
			//sPos.style.borderColor = '#999999';
			//document.getElementById(txtShowLen).style.display = 'none';
			//document.getElementById(txtShowPos).style.display = 'none';
		}
}

function showHideSinkDims(chk,txtShowDims){
	var sDims;
	sDims = document.getElementById(txtShowDims);
	if(chk.checked){
		sDims.style.display = 'block';
		sDims.style.display = 'block';
	} else {
		sDims.style.display = 'none';
		sDims.style.display = 'none';
	}
}

function showHideQuantity(){
	var cusType = document.forms.quoteForm.ddlCustomerTypes.value
	if(cusType != 'Code3'){
		document.getElementById('posQuantity').style.display = 'block';
	} else {
		document.getElementById('posQuantity').style.display = 'none';
	}
}

function showHideDims(cntr){
	//hide all the panels
	document.getElementById('introInfo').style.visibility = 'hidden';
	document.getElementById('leftCounterInfo').style.visibility = 'hidden';
	document.getElementById('topCounterInfo').style.visibility = 'hidden';
	document.getElementById('rightCounterInfo').style.visibility = 'hidden';
	//now unhide the one selected
	document.getElementById(cntr).style.visibility = 'visible';
	//show mitres no matter what
	document.getElementById('mitres').style.visibility = 'visible';
	
}

function showHideEndTypes(et){
	//hide all the panels
	if (et=='finishedEnd1'){
		document.getElementById('finishedEnd1').style.display = 'block';
		document.getElementById('finishedEnd2').style.display = 'none';
		window.scrollTo(0,1000);
	} else if (et=='finishedEnd2'){
		document.getElementById('finishedEnd1').style.display = 'none';
		document.getElementById('finishedEnd2').style.display = 'block';
		window.scrollTo(0,1000);
	} else {
		document.getElementById('finishedEnd1').style.display = 'none';
		document.getElementById('finishedEnd2').style.display = 'none';
	}
}

var selEnd1='images/ends175_finished_end.jpg';
var selEnd2='images/ends175_finished_end.jpg';
var selEnd3='images/ends175_finished_end.jpg';
var selEnd4='images/ends175_finished_end.jpg';
var selEndTitle1='Finished End';
var selEndTitle2='Finished End';
var selEndTitle3='Finished End';
var selEndTitle4='Finished End';
var selEnd1BG,selEnd2BG,selEnd3BG,selEnd4BG;
var selColour='counter_colours/new/STOCKCRYSTAL_120.jpg';
var selLargePhoto='counter_colours/flash/2006/img_STOCKCRYSTAL.swf';
var selColourTitle='STOCKCRYSTAL';

function setSelectedEnds(selEnd,imSrc,selEndId,txtTitle){
	//hide all the panels
	if (selEnd==1) {
		selEnd1 = imSrc;
		selEnd1BG = selEndId;
		selEndTitle1 = txtTitle;
			//document.getElementById(selEnd1BG).style.backgroundColor = '#DEBA00';
	} if (selEnd==2) {
		selEnd2 = imSrc
		selEnd2BG = selEndId;
		selEndTitle2 = txtTitle;
 	} if (selEnd==3) {
		selEnd3 = imSrc;
		selEnd3BG = selEndId;
		selEndTitle3 = txtTitle;
	} if (selEnd==4) {
		selEnd4 = imSrc;
		selEnd4BG = selEndId;
		selEndTitle4 = txtTitle;
	}
}

function redisplaySelectedEnds(x){
	//window.status(selEnd);
	if(document.forms.quoteForm.readOnlyRollovers.value=='0'){
		if(x==1){ 
			MM_swapImage('endFinish1','',selEnd1,1);
			setEndTitle(1,selEndTitle1);
			
		} else if(x==2){
			MM_swapImage('endFinish2','',selEnd2,1);
			setEndTitle(2,selEndTitle2);
		}
	}
}

function redisplaySelectedEnds2(x){
	//window.status(selEnd);
	if(document.forms.quoteForm.readOnlyRollovers.value=='0'){
		if(x==1){ 
			MM_swapImage('endFinish1','',selEnd1,1);
			setEndTitle2(1,selEndTitle1);
			
		} else if(x==2){
			MM_swapImage('endFinish2','',selEnd2,1);
			setEndTitle2(2,selEndTitle2);
		}
	}
}

function setEndTitle(x,txtTitle){
	//switch (x) {
	//	case 1:
	if(x==1){ 
		document.getElementById('end1_Title').innerHTML = txtTitle;
		document.forms.quoteForm.txtEndType1.value = txtTitle;
		document.forms.quoteForm.txtEndType1b.value = txtTitle;
	} else if(x==2){ 
		document.getElementById('end2_Title').innerHTML = txtTitle;
		document.forms.quoteForm.txtEndType2.value = txtTitle;
		document.forms.quoteForm.txtEndType2b.value = txtTitle;
	}
}

function setEndTitle2(x,txtTitle){
	//switch (x) {
	//	case 1:
	if(x==1){ 
		document.getElementById('end1_Title').innerHTML = txtTitle;
		document.forms.quoteForm.txtEndType1.value = txtTitle;
	} else if(x==2){ 
		document.getElementById('end2_Title').innerHTML = txtTitle;
		document.forms.quoteForm.txtEndType2.value = txtTitle;
	}
}

function restoreEndsBG(x,endId){
	//endId.style.backgroundColor = '#006845';
	if(x==1){ 
		document.getElementById(endId).style.backgroundColor = '#ffffff'; 
	} else if(x==2){ 
		document.getElementById(selEnd1BG).style.backgroundColor = '#DEBA00'; 
	}
	redisplaySelectedEnds();

}

function restoreEndsBG2(x,endId){
	//endId.style.backgroundColor = '#006845';
	if(x==1){ 
		document.getElementById(endId).style.backgroundColor = '#ffffff'; 
	} else if(x==2){ 
		document.getElementById(selEnd1BG).style.backgroundColor = '#DEBA00'; 
	}
	redisplaySelectedEnds2();

}

function setSelectedColour(imSrc,largeCounter,txtTitle){
	//hide all the panels
	//selEnd4 = imSrc;
	//selEnd4BG = selColourId;
	//selEndTitle4 = txtTitle;
	selColour=imSrc;
	selColourTitle=txtTitle;
	selLargePhoto=largeCounter;
	//MM_swapImage('mainCounter','',largeCounter,1);
	objFlash.swf = largeCounter;
	if(largeCounter != '') { objFlash.render("flashCounter"); }
	document.forms.quoteForm.txtQuoteColour.value = txtTitle;
}

function setSelectedColour2(imSrc,largeCounter,txtTitle){
	//hide all the panels
	//selEnd4 = imSrc;
	//selEnd4BG = selColourId;
	//selEndTitle4 = txtTitle;
	selColour=imSrc;
	selColourTitle=txtTitle;
	selLargePhoto=largeCounter;
	//MM_swapImage('mainCounter','',largeCounter,1);
	objFlash.swf = largeCounter;
	if(largeCounter != '') { objFlash.render("flashCounter"); }
}

function setColourTitle(txtTitle){
	//switch (x) {
	//	case 1:
	document.getElementById('txtColourName').innerHTML = txtTitle; 
}

function redisplaySelectedColour(){
	//window.status(selEnd);
	if(document.forms.quoteForm.readOnlyRollovers.value=='0'){
		MM_swapImage('largeTexture','',selColour,1);
		setColourTitle(selColourTitle);
	}
}

function resetAllCounterSections(){
	//hide all the panels
	document.getElementById('ip3_tl').src='profiles/p3_tl_off.gif'
	document.getElementById('ip3_tm').src='profiles/p3_tm_off.gif'
	document.getElementById('ip3_bl').src='profiles/p3_bl_off.gif'
	document.getElementById('ip3_tr').src='profiles/p3_tr_off.gif'
	document.getElementById('ip3_br').src='profiles/p3_br_off.gif'
	document.getElementById('ip3_bl_end').src='profiles/p3_bl-end.gif'
	document.getElementById('ip3_br_end').src='profiles/p3_br-end.gif'
	document.getElementById('ip3_tl').src='profiles/p3_tl_off.gif'
	document.getElementById('ip3_tl').src='profiles/p3_tl_off.gif'
}

function selCounterSection(p,iSrc){
	
	document.getElementById('U-2mitre_bg').src= iSrc;
	/*
	if(p=='left'){
		document.getElementById('U-2mitre_bg').src='schematics/U-2mitre_left.gif'
		
	} else if(p=='right'){
		document.getElementById('U-2mitre_bg').src='schematics/U-2mitre_right.gif'
		
	} else if(p=='top'){
		document.getElementById('U-2mitre_bg').src='schematics/U-2mitre_top.gif'
		
	}
	*/
}


function selCounterSection_BAK(p){
	
	if(p=='left'){
		document.getElementById('U-2mitre_bg').src='schematics/U-2mitre_left.gif'
		
	} else if(p=='right'){
		document.getElementById('U-2mitre_bg').src='schematics/U-2mitre_right.gif'
		
	} else if(p=='top'){
		document.getElementById('U-2mitre_bg').src='schematics/U-2mitre_top.gif'
		
	}
}


function selCounterSectionOLD(p){
	//hide all the panels
	if(p=='left'){
		document.getElementById('ip3_tl').src='profiles/p3_tl_left_on.gif'
		document.getElementById('ip3_tm').src='profiles/p3_tm_off.gif'
		document.getElementById('ip3_bl').src='profiles/p3_bl_on.gif'
		document.getElementById('ip3_tr').src='profiles/p3_tr_off.gif'
		document.getElementById('ip3_br').src='profiles/p3_br.gif'
		document.getElementById('ip3_bl_end').src='profiles/p3_bl-end_on.gif'
		document.getElementById('ip3_br_end').src='profiles/p3_br-end.gif'
		//document.forms.quoteForm.left_length.field.focus();
		
	} else if(p=='right'){
		document.getElementById('ip3_tl').src='profiles/p3_tl_off.gif'
		document.getElementById('ip3_tm').src='profiles/p3_tm_off.gif'
		document.getElementById('ip3_bl').src='profiles/p3_bl.gif'
		document.getElementById('ip3_tr').src='profiles/p3_tr_right_on.gif'
		document.getElementById('ip3_br').src='profiles/p3_br_on.gif'
		document.getElementById('ip3_bl_end').src='profiles/p3_bl-end.gif'
		document.getElementById('ip3_br_end').src='profiles/p3_br-end_on.gif'
		//document.forms.quoteForm.left_length.field.focus();

	} else if(p=='top'){
		document.getElementById('ip3_tl').src='profiles/p3_tl_top_on.gif'
		document.getElementById('ip3_tm').src='profiles/p3_tm_on.gif'
		document.getElementById('ip3_bl').src='profiles/p3_bl.gif'
		document.getElementById('ip3_tr').src='profiles/p3_tr_top_on.gif'
		document.getElementById('ip3_br').src='profiles/p3_br.gif'
		document.getElementById('ip3_bl_end').src='profiles/p3_bl-end.gif'
		document.getElementById('ip3_br_end').src='profiles/p3_br-end.gif'
		//document.forms.quoteForm.left_length.field.focus();

	}
}

function loadCounterDepths(cType,target,hField,rPanelField,rPanelDepth){
	
	var objCboTarget = document.getElementById(target);
	var objCounterType = document.getElementById(cType);
	var objHiddenField = document.getElementById(hField);
	var objPanelType = document.getElementById(rPanelField);
	var objPanelDepth = document.getElementById(rPanelDepth);
	
	var selOption = objCounterType.options[objCounterType.selectedIndex].value;
	window.status = selOption;
	
	//clear the depths option
	removeOptionAllOptions(target);
	
	if(selOption=='B'){
		var elOptNew1 = document.createElement('option');
		var elOptNew2 = document.createElement('option');
		var elOptNew3 = document.createElement('option');
		elOptNew1.text = '15.0';
  		elOptNew1.value = '15.0';
		objCboTarget.add(elOptNew1);
		elOptNew2.text = '27.0';
  		elOptNew2.value = '27.0';
		objCboTarget.add(elOptNew2);
		elOptNew3.text = '36.0';
  		elOptNew3.value = '36.0';
		objCboTarget.add(elOptNew3);
		//window.status = '36.0';
		objHiddenField.value = '15.0';
		objPanelType.value = 'BARTOP';
		objPanelDepth.value = '15.0';
	} else if(selOption=='CB'){
		var elOptNew1 = document.createElement('option');
		elOptNew1.text = '25.5';
  		elOptNew1.value = '25.5';
		objCboTarget.add(elOptNew1);
		objHiddenField.value = '25.5';
		objPanelType.value = 'CUT BACK (NO BACKSPLASH)';
		objPanelDepth.value = '25.5';
	} else if(selOption=='K'){
		var elOptNew1 = document.createElement('option');
		elOptNew1.text = '25.5';
  		elOptNew1.value = '25.5';
		objCboTarget.add(elOptNew1);
		objHiddenField.value = '25.5';
		objPanelType.value = 'KITCHEN TOP (BACKSPLASH)';
		objPanelDepth.value = '25.5';
	} else if(selOption=='V'){
		var elOptNew1 = document.createElement('option');
		elOptNew1.text = '23.25';
  		elOptNew1.value = '23.25';
		objCboTarget.add(elOptNew1);
		objHiddenField.value = '23.25';
		objPanelType.value = 'VANITY';
		objPanelDepth.value = '23.25';
	}
	
}


function removeOptionAllOptions(cboTarget)
{
  var elSel = document.getElementById(cboTarget);
  var i;
  for (i = elSel.length - 1; i>=0; i--) {
    //if (elSel.options[i].selected) {
      elSel.remove(i);
    //}
  }
}


function changeStoveLabel(stoveType,target){
	
	var objStoveType = document.getElementById(stoveType);
	var objStoveTarget = document.getElementById(target);
	var txtStove = objStoveType.options[objStoveType.selectedIndex].value;
	
	if(txtStove=='1'){
		objStoveTarget.innerHTML = 'Regular<br>Stove';
	} else if(txtStove=='2'){
		objStoveTarget.innerHTML = 'Slide in<br>Stove';	
	} else if(txtStove=='3'){
		objStoveTarget.innerHTML = 'Stove Top';	
	}
	//window.status = selOption;
	
}

function updateSecondField(source,target,hField){
	var objSrc = document.getElementById(source);
	var objTarget = document.getElementById(target);
	var objHiddenField = document.getElementById(hField);
	//window.status = objTarget.value;
	objTarget.value = objSrc.options[objSrc.selectedIndex].value;
	objHiddenField.value = objSrc.options[objSrc.selectedIndex].value;
	
}

function thisMovie(movieName) {
	if(navigator.appName.indexOf("Microsoft") !=-1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}

function movieIsLoaded(theMovie) {
	if(typeof(theMovie) != "undefined"){
		return theMovie.PercentLoaded() == 100;
	} else {
		return false;
	}
}

function playMovie(f) {
	//if(movieIsLoaded(document.cColour)){
		//thisMovie('cColour').GotoFrame(f);
		//window.status = f;
		var fNum = parseInt(f,10)
		document.cColour.GotoFrame(fNum);
		document.cColour.Play();
		//thisMovie('cColour').Play();
	//}
}

//-->
