function thefocus(e,o){
if(o.firstTime){return}
o.firstTime=true
o.value=""
}

// Programming by Fabrice Murgia
// Licensed to Sphere Concepts
function checkThePassword() {
	var password = window.prompt("CATALOG UNDER CONSTRUCTION - Please insert your password:");
	if (password != "spherestarbucks") {
	  window.alert("Sorry, your password is not authorized    ");
	} else {
		popCatalog();
	}
}
//===================================================================================
//-------------------------------------------------------------- Beginning JS PRELOAD
function printCatalog() {
var printYN = readCookie("printIt");
if (printYN == '109') {
	alert('Please use PRINT button at the bottom of the Quotation Request     ');
	}
if (printYN == "203") {
	alert('You need to perform a search before printing     ');
	}
if (printYN == 'no') {
	alert("There's no printable data for this section    ");
	}
	if (printYN == 'c1') {
	//alert('printing allowed for content.pl     ');
	top.c1Main.focus();
	top.c1Main.print();
	}
if (printYN == "c2") {
	//alert('print allowed for content2.pl    ');
	top.c1Main.c2main.focus();
	top.c1Main.c2main.print();
	}
if (printYN == 'c3') {
	//alert('print allowed for search.pl    ');
	top.c1Main.c3main.focus();
	top.c1Main.c3main.print();
	}
}
//-------------------------------------------------------------------- End JS PRELOAD
//===================================================================================
//-------------------------------------------------------------- Beginning JS PRELOAD
textpdf = new Image(); textpdf.src = "http://www.paragonconcept.com/images/seq_mpty.gif";
textsearch = new Image(); textsearch.src = "http://www.paragonconcept.com/images/sequence.gif";

function JSpreload() {
if(document.all)top.c1Down.text.src = textpdf.src;
//alert("JS-PRELOAD    ");
}

function showSearch() {
if(document.all)top.c1Down.text.src = textsearch.src;
}
//-------------------------------------------------------------------- End JS PRELOAD
//===================================================================================
//------------------------------------------------------ Beginning ALL-PURPOSE POP-UP
var allPurpose = null;

function popWin(theW,theH,thePage,theScroll,thePos) {
	if (allPurpose == null || allPurpose.closed) {
	//------- example: popWin('600','250','content.htm','yes','center')
	if (theScroll == 'scroll') {
		scrollit = 'yes';
	} else { 
		scrollit = 'no';
	}
	if (thePos == 'top') {
		winLeft = Math.round(screen.width * 0.1); 
		winTop = Math.round(screen.height * 0.1);
	}
	if (thePos == 'center') {
		winLeft = Math.round(screen.width * 0.5); 
		winTop = Math.round(screen.height * 0.5) - 12;
	}
	if (thePos == 'right') {
		winLeft = Math.round(screen.width - (screen.width * 0.1)) - theW; 
		winTop = Math.round(screen.height * 0.1);
	}
	//var winLeft = Math.round((screen.width - theW) * ratioW);
	//var winTop = Math.round(((screen.height - theH) * ratioH) - 12);
	winOnly = "statusbar=no,toolbar=no,menubar=no,personalbar=no,location=no,locationbar=no,resizable=no,screenX=0,screenY=0,directories=no,scrollbars="+scrollit;
	winprops = "height="+theH+",width="+theW+",top="+winTop+",left="+winLeft+winOnly;
	allPurpose = window.open(thePage,'newWin', winprops);
	allPurpose.focus();
	}
	else
	{
	//alert('window is open');
	allPurpose.close();
	popWin(theW,theH,thePage,theScroll,thePos);
	}
}
//------------------------------------------------------------ End ALL-PURPOSE POP-UP
//===================================================================================
//------------------------------------------------------ Beginning ALL-PURPOSE POP-UP
//var allPurpose = null;

function enlargeImage(thePage) {
	var thePage = "/images_LG/"+thePage;
	alert(thePage);
//	if (allPurpose == null || allPurpose.closed) {
	//------- example: popWin('600','250','content.htm','yes','center')
//	if (theScroll == 'scroll') {
//		scrollit = 'yes';
//	} else { 
//		scrollit = 'no';
//	}
//	if (thePos == 'top') {ratioW = 0.2; ratioH = 0.25};
//	if (thePos == 'center') {ratioW = 0.5; ratioH = 0.5};
//	if (thePos == 'left') {ratioW = 0.8; ratioH = 0.25};
//	var winLeft = Math.round((screen.width - theW) * ratioW);
//	var winTop = Math.round(((screen.height - theH) * ratioH) - 12);
//	winOnly = "statusbar=no,toolbar=no,menubar=no,personalbar=no,location=no,locationbar=no,resizable=no,screenX=0,screenY=0,directories=no,scrollbars="+scrollit;
	winprops = "width=550,height=225";//+winOnly;
	enlargeImage = window.open(thePage,'', winprops);
	enlargeImage.focus();
//	}
//	else
//	{
	//alert('window is open');
//	allPurpose.close();
//	popWin(theW,theH,thePage,theScroll,thePos);
//	}
}
//------------------------------------------------------------ End ALL-PURPOSE POP-UP
//===================================================================================
//--------------------------------------------------------- Beginning IMAGE ROLL-OVER
function rollit(img,roll) {
eval("document."+img+".src="+img+roll+".src");
}
//--------------------------------------------------------------- End IMAGE ROLL-OVER
//===================================================================================
//-------------------------------------------------- Beginning DYNAMIC FRAME RESIZING
var upDown = "down";
var slideControl = "";

function slideFrame(frameType) {
	var slideControl = "go"
	if (frameType == "c2") {
		if (document.all) {//if IE
			if (upDown == "down" && slideControl == "go") {
				parent.document.all.c2frames.rows="45,45,*"; 
				upDown = "up";
				slideControl = "stop";
			}
			if (upDown == "up" && slideControl == "go") {
				parent.document.all.c2frames.rows="225,45,*";
				upDown = "down";
				slideControl = "stop";
			}
		} else {//if Netscape
			if (upDown == "down") {
				parent.document.getElementById('c2frames').rows='225,45,*';
				upDown = "up";
			} 
			if (upDown == "up") {
				parent.document.getElementById('c2frames').rows='45,45,*';
				upDown = "down";
			}
		}
	}
	if (frameType == "c3") {
		if (document.all) {//if IE
			if (upDown == "down" && slideControl == "go") {
				parent.document.all.c3frames.rows="45,*"; 
				upDown = "up";
				slideControl = "stop";
			}
			if (upDown == "up" && slideControl == "go") {
				parent.document.all.c3frames.rows="225,*";
				upDown = "down";
				slideControl = "stop";
			}
		} else {//if Netscape
			if (upDown == "down") {
				parent.document.getElementById('c3frames').rows='225,*';
				upDown = "up";
			} 
			if (upDown == "up") {
				parent.document.getElementById('c3frames').rows='45,*';
				upDown = "down";
//			popWin('670','270','i203_pop.htm','yes','left');
			}
		}
	}
}

function resizeFrame() {
	if (slideControl == "stop") {
	eval("parent.document.all.c2frames.rows='"+theCounter+",45,*'"); 
	}
}
//-------------------------------------------------------- End DYNAMIC FRAME RESIZING
//===================================================================================
//---------------------------------------------------- Beginning POP-UP FOCUS CONTROL
function createCookie(cookieName,value) {
	var expires = "";
	var ck = cookieName+"="+value+expires+"; path=/";
	//alert('write cookie: '+value);//---------------------------DISABLE ON LIVE SITE
	document.cookie = ck;
}

function readCookie(cookieName) {
	var nameEQ = cookieName + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
//---------------------------------------------------------- End POP-UP FOCUS CONTROL
//===================================================================================
//------------------------------------------------------- Beginning QUERY 203 SECTION
function search203() {
	var s_thick = document.cat203.theThick.options[document.cat203.theThick.selectedIndex].value;
	var s_flat = document.cat203.theFlat.options[document.cat203.theFlat.selectedIndex].value;
	var s_color = document.cat203.theColor.options[document.cat203.theColor.selectedIndex].value;
	//alert(s_thick+"; "+s_width+"; "+s_color);//DISABLE ON LIVE SITE
	if (s_thick == "" || s_flat == "" || s_color == "") {
		alert("You must use all pull-downs to peform a search    ");
		return false;
	} else {
	showSearch();
	theQuery203 = "/cgi-bin/content2.pl?flat="+s_flat+"&color="+s_color+"&thick="+s_thick;
	//alert(theQuery203);
	parent.c2main.location.href = theQuery203;
	createCookie("printIt","c2");//enable printing for content2.pl
	return false;
	}
}
//------------------------------------------------------------- End QUERY 203 SECTION
//===================================================================================
//-------------------------------------------------------- Beginning QUERY TOP SEARCH
function topSearch() {
	var whatToSearch = document.site_search.searchString.value;
	if(whatToSearch == "")
	{
	    alert("Enter a value to search");
	    return false;
	}
	
}
//-------------------------------------------------------------- End QUERY TOP SEARCH
//===================================================================================
//----------------------------------------------------------- Beginning QUERY CATALOG
function queryCatalog(section, type) {
	if (type == "c2") {
		if (section == '109') {
		//window.alert('C2 - section: '+section);//DISABLE ON LIVE SITE
			createCookie("printIt","109");//disable bottom print button
			parent.c1Main.location.href = "c0_form.htm";
			}
		if (section == '203') {
		//window.alert('C2 - secion: '+section);//DISABLE ON LIVE SITE
			parent.c1Main.location.href = "content2.htm";
			createCookie("printIt","203");//disable bottom print button
			}
	}
	if (type == "c1") {
		showSearch();
		//window.alert('C1 - section: '+section);//DISABLE ON LIVE SITE
		theQuery = "/cgi-bin/content.pl?item="+section;
		parent.c1Main.location.href = theQuery;
		createCookie("printIt","c1");//enable print for content.pl
	}
	if (type == "c3") {
		showSearch();
		//window.alert('C3 - section: '+section);//DISABLE ON LIVE SITE
		theQuery = "/cgi-bin/content3.pl?item="+section;
		theFlashMovie = "c3_"+section+".htm";
		//alert(theFlashMovie);
		parent.c1Main.document.open();
		parent.c1Main.document.write("<html><head><title>Untitled Document</title></head>");
		parent.c1Main.document.write("<frameset id='c3frames' rows='225,*' frameborder='NO' border='0' framespacing='0'>");
		parent.c1Main.document.write("<frame src='" + theFlashMovie + "' name='c3top' scrolling='NO' noresize>");
		parent.c1Main.document.write("<frame src='" + theQuery + "' name='c3main' scrolling='yes'>");
		parent.c1Main.document.write("</frameset><noframes><body></body></noframes></html>");
		parent.c1Main.document.close();
		createCookie("printIt","c3");//enable print for content3.pl
	}
		
}
//----------------------------------------------------------------- End QUERY CATALOG
//===================================================================================
//---------------------------------------------------------- Beginning CATALOG POP-UP
function popCatalog() {
	var checkIfOpen = readCookie("catalogOpen");
	//alert("read cookie: "+checkIfOpen);//----------------------DISABLE ON LIVE SITE
	if (checkIfOpen == "closed") {
		createCookie("catalogOpen","open");
		createCookie("printIt", "no");
		if (screen.width < 1024) {
    		winW = 795;
			winH = 496;
			}	
		if (screen.width >= 1024) {
  			winW = 960;//960
			winH = 675;//675
			}
		var winLeft = Math.round((screen.width-winW)/2);
		var winTop = Math.round((screen.height-winH)/3)-16;
		winOnly = "statusbar=no,toolbar=no,menubar=no,personalbar=no,location=no,locationbar=no,resizable=yes,screenX=0,screenY=0,directories=no,scrollbars=no";
		winprops = "height="+winH+",width="+winW+",top="+winTop+",left="+winLeft+winOnly;
		catalog = window.open("catalog.htm","catWin",winprops);
		catalog.focus();
		if(document.getElementById && !document.all) top.blur();//NN6 focus form fields
		}
	if (checkIfOpen == "open") {
	catalog.focus();
	}
}
//---------------------------------------------------------------- End CATALOG POP-UP
//===================================================================================
