	onSection = Array(0);
	t = '';
	
	function clearTo (toIdx) {
		for (i = (onSection.length - 1); i >= toIdx; i = i-1) {
			if (document.getElementById('subId'+ onSection[i])) document.getElementById('subId'+ onSection[i]).style.display = 'none';
		}
	}
	
	function mainNav (key,idx) {
		if (t) {
			clearTimeout(t);
			t = '';
		}
		if (key == onSection[idx]) {
			clearTo(idx + 1);
		} else {
			if (onSection[idx]) {
				clearTo(idx);
			}
			if (key) { 
				if (document.getElementById('subId'+ key)) document.getElementById('subId'+ key).style.display = 'block';
			} 
			onSection[idx] = key
		}
	
	}
	
	function pauseHide () {
		t = setTimeout("mainNav('',0)",750);
	}
	
	
	
	


	var onTab = 1;
	function changeTab (key) {

		if (onTab == key) {
		
		} else {
			
			document.getElementById('tab'+ onTab +'Nav').className = 'tabNavOff';
			document.getElementById('tab'+ onTab +'Info').className = 'tabInfoOff';

			document.getElementById('tab'+ key +'Nav').className = 'tabNavOn';
			document.getElementById('tab'+ key +'Info').className = 'tabInfoOn';

			onTab = key
			
			onLoadInit();
		
		}

	}




	function lightNav () {

		var args = lightNav.arguments;	
		// var mnSet = document.getElementById('mainNavigation');
		// var mnA  = mnSet.getElementsByTagName('a');
		
		for (i = 0; i < args.length; i+=1) {
			var arg = args[i]
			var elm = document.getElementById('mn'+ arg);
			if (elm) {
				elm.className = 'On';				
			}
		//	mnA[arg].setAttribute('style','color:#fff');
		//	mnA[arg].className = 'On';
		}

	}
	
	

// Email Spam hiding.
function popMail(host,user) {
	var acct = user +'@'+ host;
	self.location.href = 'mailto:'+ acct;
}
function linkMail(host,user,cls) {
	document.write('<a href="javascript:popMail(\''+ host +'\',\''+ user +'\');"');
	if (cls) {
		document.write(' class="'+ cls +'"');
	}
	document.write('>');
	showMail(host,user);
	document.write('</a>');
}
function showMail(host,user) {
	var acct = user +'@'+ host;
	document.write(acct);
}
	
	

	function onLoadInit() {
	
	//	if (self.innerHeight > document.getElementById('backframe').offsetHeight) {
	//		top.alert(document.getElementById('contentShadow').offsetHeight)
			// set this height because of ie 6's sizing method of pngs
	//		document.getElementById('contentShadow').style.height = (document.getElementById('contentTop').offsetHeight) +'px';
			
	//	}
	
	}

	function addOnLoadEvent(func) {

	  var oldonload = window.onload;

	  if (typeof window.onload != 'function') {

		window.onload = func;

	  } else {

	//	top.alert(oldonload)
	//	top.alert(func)

		window.onload = function() {

		  if (oldonload) {
			oldonload();
		  }
		  eval (func +'()');

		}

	  }

	}
	

	addOnLoadEvent(onLoadInit);


	function loadModalView () {
	
		document.getElementById('workspace').innerHTML = "<center><table cellspacing=0 cellpadding=0 border=0 width=700 id='modalFrame'><tr><td align=center><div class='modalPadding'><div id='modalContent'><table cellspacing=0 cellpadding=0 border=0 width=670 height=200><tr><td align=center><div id='modalInnerContent'></div></td></tr></table></div><div id='modalOptions'><a href='javascript:hideModal()' id='closeModalButtom'></a><div id='customModalOptions'></div></div></td></tr></table></center>";
	
	
	}
	
	function showLoading () {
	
		document.getElementById('modalInnerContent').innerHTML = '<table cellspacing=0 cellpadding=0  border=0 width="670" height="200"><tr><td align=center><b>Submiting Request</b></tr></td></table>';
	
	}
	
	function submitRequest(form,frm) {
	
		httpCon.complete = displayPage;
		httpCon.url = 'Request_Quote.php';
		httpCon.input = parseForm(frm);


		showModal();

		showLoading();

		httpCon.get();
		
	
	}
	
	function submitEmailFriend(query) {
	
		httpCon.complete = displayPage;
		httpCon.url = 'email_friend.php';
		httpCon.input = query;


		showModal();

		showLoading();

		httpCon.get();
		
	
	}


	function quoteRequest(form,collection) {
	
		showModal();
		
		httpCon.complete = displayPage;
		httpCon.url = 'Request_Quote.php';
		httpCon.input = 'Collection='+ collection +'&sendthrough='+ form;
		httpCon.get();
	
	}
	
	function emailFriend(page) {
	
		showModal();
		
		httpCon.complete = displayPage;
		httpCon.url = 'email_friend.php';
		httpCon.input = 'page='+ page;
		httpCon.get();
	
	}
	
	function showFinishes () {
	
		showPage('ModelFinishes.htm');
	
	}
	
	function showDistressings () {
	
		showPage('ModelDistressings.htm');
	
	}

	function showPage (page) {
		
		showModal();
		
		httpCon.complete = displayPage;
		httpCon.url = page;
		httpCon.get();
	
	}

	function displayPage (responseObj) {

		var html = responseObj.lastResponse

		document.getElementById('modalInnerContent').innerHTML = html

		repositionDiv('workspace',100);

		document.getElementById('workspace').style.display = 'block';

/*
		currentOverall = document.getElementById('modalFrame').offsetWidth;
		currentContent = document.getElementById('modalContent').offsetWidth;
		
		currentDiff = (currentOverall - currentContent);
		
		contentHeight = document.getElementById('modalInnerContent').offsetHeight;
		contentWidth  = document.getElementById('modalInnerContent').offsetWidth;
		
//		document.getElementById('modalContent').style.height = ((contentHeight > 200) ? contentHeight : 200) +'px';
		
		document.getElementById('modalContent').style.width = (contentWidth > 670 ? contentWidth : 670) +'px';

		document.getElementById('modalFrame').style.width = ((contentWidth > 670 ? contentWidth : 670) + currentDiff) +'px';

		top.alert(contentWidth +':'+ currentDiff +':'+ ((contentWidth > 670 ? contentWidth : 670) + currentDiff))
*/
		resizeCover('modalCover');

	}

	function showModal () {
	
		
		if (!document.getElementById('modalCover')) {
			body  = document.getElementsByTagName('body');
			cover = document.createElement('div');
			cover.setAttribute('id','modalCover');
			cover.setAttribute('class','coverOn');
			cover.setAttribute('onClick','hideModal()');
			body[0].appendChild(cover);
		}
		if (!document.getElementById('workspace')) {
			body  = document.getElementsByTagName('body');
			workspace = document.createElement('div');
			workspace.setAttribute('id','workspace');
			workspace.setAttribute('align','center');
			body[0].appendChild(workspace);
		}

		document.getElementById('modalCover').className = 'coverOn';
		resizeCover('modalCover');
	
		if (!document.getElementById('modalInnerContent')) {
			loadModalView();
		}
		
	}

	function hideModal () {
	
		document.getElementById('modalCover').className = 'coverOff';
		document.getElementById('modalInnerContent').innerHTML = '';
		document.getElementById('workspace').style.display = 'none';
		
	
	}
	









// Process FORM DATA
function parseForm (frm) {

	var string = '';

	for (i = 0; i < frm.elements.length; i++) {
		elm = frm.elements[i]
		
		if (elm.type == 'checkbox') {
			if (elm.checked) {
				string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].value);
			}
		} else if (elm.type == 'radio') {
			if (elm.checked) {
				string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].value);
			}
		} else if (elm.type == 'select') {
			if (elm.selectedindex >= 0) {
				string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].options[elm.selectedIndex].value);
			}
		} else {
			string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].value);
		}
	
	}

	return string

}









function repositionDiv(objId,plusDistance)
{

	obj = document.getElementById(objId);

	page_pos = getPagePosition();
	document.getElementById(objId).style.top = (page_pos[1] < plusDistance ? plusDistance : page_pos[1] + 20) +'px';
	
}

function resizeCover (objId) {

	page_dims = getPageSizeWithScroll();
	document.getElementById(objId).style.height = page_dims[1]+'px';

}

function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	return arrayPageSizeWithScroll;
}

function getPagePosition ()
{
  var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}




/****

FORM FUNCTIONS

**/



/* VIEW LARGER */

	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	
		//img_on	= newImage("/pics/index_nav/index_con.gif");
		//img_off	= newImage("/pics/index_nav/index_con.gif");
	}
	
	// Browser Detection
	var V = navigator.appVersion.substring(0,1);
	var brsr = 0;
	if (V < 4) {
		top.alert("This site uses java to support its major navigation.\n You may have trouble viewing the site");
	} else if (navigator.appName.indexOf("Netscape") > -1) {
	
	} else if (navigator.appName.indexOf("Explorer") > -1) {
			var T = navigator.appVersion.indexOf("MSIE");
			T += 5;
			V = navigator.appVersion.substring(T,eval(T+1));
	}
	if (navigator.appName.indexOf("Netscape") > -1) {
		brsr = 1;
	} else if (navigator.appName.indexOf("Explorer") > -1) {
		if (V < 5) {
	
		} else {
			brsr = 2;
		}
	}

	function changeImages() {
	//	if (document.images && (preloadFlag == true)) {
			for (var i=0; i<changeImages.arguments.length; i+=3) {
			//  top.alert (document.layers[i].document[changeImages.arguments[i+1]].name)
			//document.layers[changeImages.arguments[i]].document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src");
				if (brsr == 1) {
			//		if (changeImages.arguments[i] != '') {
			//			document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src")
			//		} else {
						if (document[changeImages.arguments[i+1]]) document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src")
			//		}
				}
				if (brsr == 2) {
					if (document[changeImages.arguments[i+1]]) document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src")
				}
			}
	//	}
	}
	
function emailFriendSubmit()
{
	var string = 'You must enter ';
	var alert_message = '';
	frm = document.frm_email_friend;
	var sender_name = frm.sname.value;
	var sender_email = frm.semail.value;
	var friend_name = frm.fname.value;
	var friend_email = frm.femail.value;
	var message = frm.message.value;
	var url = frm.url.value;
	
	if (trimAll(sender_name) == "") 
	{	
		alert_message += string + " your name.\n";
	}
	if (trimAll(sender_email) == "") 
	{	
		alert_message += string + " your email.\n";
	}
	if (trimAll(friend_name) == "") 
	{	
		alert_message += string + " your friend's name.\n";
	}
	if (trimAll(friend_email) == "") 
	{	
		alert_message += string + " your friend's email.\n";
	}
	
	if(alert_message != '')
	{
		alert(alert_message);
		//return false;
	} else {
		submitEmailFriend('sname=' + encodeURIComponent(sender_name) + '&semail=' + encodeURIComponent(sender_email) +
						  '&fname=' + encodeURIComponent(friend_name) + '&femail=' + encodeURIComponent(friend_email) +
						  '&message=' + encodeURIComponent(message) + '&url=' + encodeURIComponent(url) + '&sendemail=1');
	}
}





/*  modal elements */


	function checkHeight () {
		top.alert(document.getElementById('innerFrame').innerHeight)
	}

	function resizeWorkspace () {

	//	imgObj = document.getElementById('modalImage');
	//	spinnerObj = document.getElementById('spinner');
		
		w = imgElm.width;
		h = imgElm.height;
		
//		w = spinner.offsetWidth;
//		h = spinner.offsetHeight;

		centerDiv('workspace',(w+20));
		document.getElementById('workspace').style.height = (h+20) +'px';
		
	//	top.alert(w +' x '+ h);
	//	top.alert(imgElm.width +':'+ imgElm.height);
		
	//	spinnerObj
		
		cover = document.getElementById('modalCover');
		content = document.getElementById('modalContent');
		spinner = document.getElementById('modalSpinner');
		spinner.src = imgElm.src;
		spinner.width = w;
		spinner.height = h;

	//	spinner.parentNode.removeChild(spinner);
	//	content.removeChild(content.getElementsByTagName('img').firstChild);
	//	content.appendChild(imgObj);
	//	imgObj.style.position = 'relative';
	//	imgObj.style.visibility = 'visible';
	//	cover.removeChild(imgObj);
			
	}

	var imgElm = null;

	function modalImage (imageUrl) {
	
		showModal();

		centerDiv('workspace',50);
		repositionDiv('workspace',120,20);

		document.getElementById('workspace').style.height = 50 +'px';
		document.getElementById('workspace').style.visibility = 'visible';
		
		content = document.getElementById('modalContent');

		spinElement = document.createElement('img');
		spinElement.setAttribute('id','modalSpinner');
		spinElement.setAttribute('src','/images/spinner_large.gif');
		content.appendChild(spinElement);
			
//		document.getElementById('modalContent').innerHTML = "<center><img src=''></center>";
		
		imgElm = new Image()
		imgElm.onload = function () {
			resizeWorkspace();
		}
		imgElm.src = imageUrl;
	
//		imgElement = document.createElement('img');
	//	imgElement.setAttribute('src',imageUrl);
	//	imgElement.setAttribute('id','modalImage');
	//	imgElement.setAttribute('style','visibility:hidden;position:absolute;top:0px;left:0px;');
	//	imgElement.setAttribute('onLoad','resizeWorkspace()');
	//	imgElement.onload = function () {
	//		resizeWorkspace();
	//	}

	//	content.appendChild(imgElement);
	
	}

	function innerPage (pageUrl,w,h) {

		
		showModal();
		
		centerDiv('workspace',w);
		repositionDiv('workspace',120,20);
		document.getElementById('workspace').style.height = h +'px';
		document.getElementById('workspace').style.visibility = 'visible';
		document.getElementById('modalContent').innerHTML = "<iframe src='"+ pageUrl +"' id='innerFrame' width='100%' height='"+ (h - 30) +"' frameborder=0 ></iframe>";
		
	
	}


	function loadModalView () {
	
		document.getElementById('workspace').innerHTML = "<a href='javascript:hideModal()' id='closeModal'>CLOSE X</a><div class=modalPadding><div id='modalContent'></div></div>";		
	
	}


	function showModal () {
	
		
		if (!document.getElementById('modalCover')) {
			body  = document.getElementsByTagName('body');
			cover = document.createElement('div');
			cover.setAttribute('id','modalCover');
			cover.setAttribute('class','coverOn');
			cover.setAttribute('onClick','hideModal()');
			body[0].appendChild(cover);
		}
		if (!document.getElementById('workspace')) {
			body  = document.getElementsByTagName('body');
			workspace = document.createElement('div');
			workspace.setAttribute('id','workspace');
			workspace.setAttribute('align','center');
			body[0].appendChild(workspace);
		}

		document.getElementById('modalCover').className = 'coverOn';
		resizeCover('modalCover');
		document.getElementById('workspace').style.display = 'block'
	
		if (!document.getElementById('modalContent')) {
			loadModalView();
		}
		
	}

	function hideModal () {
	
		document.getElementById('modalCover').className = 'coverOff';
		document.getElementById('modalContent').innerHTML = '';
		document.getElementById('workspace').style.visibility = 'hidden';
		document.getElementById('workspace').style.display = 'none';
	
	}
	


function centerDiv(objId,width)
{

	obj = document.getElementById(objId);
	page_pos = getPagePosition();
	page_size = getPageSizeWithScroll();
	leftPos = ((page_size[0] - width)/2);
	if (leftPos < 0) leftPos = 0; 

	obj.style.width = width +'px';
	obj.style.left  = leftPos +'px';
	
}


function repositionDiv(objId,minDistance,plusDistance)
{

	obj = document.getElementById(objId);
	page_pos = getPagePosition();
	document.getElementById(objId).style.top = (page_pos[1] < minDistance ? minDistance : page_pos[1] + plusDistance) +'px';
	
}

function resizeCover (objId) {

	page_dims = getPageSizeWithScroll();
	document.getElementById(objId).style.height = page_dims[1]+'px';

}

function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	return arrayPageSizeWithScroll;
}

function getPagePosition ()
{
  var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}
	
	


