function setCookie(name, value, expires) {
	var curCookie = name + "=" + escape(value) +	"; expires=" + expires.toGMTString() + "; path=/";
	document.cookie = curCookie;
}
function getCookie(name) { // use: getCookie("name");
  bikky = document.cookie;
  var index = bikky.indexOf(name + "=");
  if (index == -1) return null;
   index = bikky.indexOf("=", index) + 1;
 	  var endstr = bikky.indexOf(";", index);
 	  if (endstr == -1) endstr = bikky.length;
	  return unescape(bikky.substring(index, endstr));
}
document.write('<link REL="SHORTCUT ICON" href="http://www.greenteadesign.com/favicon.ico">');
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (checkIt('netscape')) browser = "Mozilla"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac";
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function writeCookie_screen() 
	{
	 var today = new Date();
	 var the_date = new Date("December 31, 2023");
	 var the_cookie_date = the_date.toGMTString();
	 var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
	 var the_cookie = the_cookie + ";expires=" + the_cookie_date + "; path=/";
	 document.cookie=the_cookie
	}

writeCookie_screen();
	
function popitup_contact(url)
{}
	
function readCookie(name) {
	var cookieValue = "";
	var search = name + "=";
  	if(document.cookie.length > 0) { 
   		offset = document.cookie.indexOf(search);
	   	if (offset != -1)  { 
   			offset += search.length;
    		end = document.cookie.indexOf(";", offset);
	     	if (end == -1) end = document.cookie.length;
    			cookieValue = unescape(document.cookie.substring(offset, end))
	    }
	}
	return cookieValue;
}
	
// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours) {
	expire2 = new Date((new Date()).getTime() + hours * 3600000);
	var curCookie2 = name + "=" + escape(value) +	"; expires=" + expire2.toGMTString() + "; path=/";
	document.cookie = curCookie2;
}

function setCookieBetter(name, value, expires) {
	expire = new Date((new Date()).getTime() + expires * 3600000);
	var curCookie = name + "=" + escape(value) +	"; expires=" + expire.toGMTString() + "; path=/";
	document.cookie = curCookie;
}

function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
	if(ok.indexOf(e.charAt(i))<0){ 
	return (false);
	}	
	} 
	if (document.images) {
	re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
	re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	if (!e.match(re) && e.match(re_two)) {
	return (-1);		
	} 
	}
}

function check_form(f) {
	if(!check_email(f.email.value)){
	alert("Your email address is invalid.  Please try again.");
	f.email.focus(); 
	if(document.all || document.getElementByID){
	f.email.style.background = "white";
	}
	return false;
	}
}


function getPageSize(){	
	var xScroll, yScroll;	
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}		
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight*3;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function hideText()
{
	document.getElementById('text1').style.visibility = 'hidden';
	document.getElementById('text2').style.visibility = 'hidden';
	document.getElementById('text3').style.visibility = 'hidden';
	document.getElementById('text4').style.visibility = 'hidden';
	document.getElementById('text5').style.visibility = 'hidden';	
}
function showText(el_id)
{
	hideText();
	document.getElementById('text'+el_id).style.visibility = 'visible';
}
pic1 = new Image(192,25);
pic1.src = '/phppages/images/topnavbglink_feb0708.gif';


function hideDHTML(id)	{
	document.getElementById(id).style.visibility = 'hidden';		
	document.getElementById('overlay_' + id).style.width = 0 +"px";
	document.getElementById('overlay_' + id).style.height = 0 +"px";	
	document.getElementById('overlay_' + id).style.visibility='hidden';	
}


function show_doorstlyes(){
	arrayPageSize = getPageSize();
	marginThisLeft2 = (arrayPageSize[0] - 876) / 2;
	document.getElementById('door_styles').style.marginLeft = marginThisLeft2;
	document.getElementById('door_styles').style.visibility='visible';
	document.getElementById('overlay_door_styles').style.visibility='visible';
	document.getElementById('overlay_door_styles').style.width = arrayPageSize[0] +"px";
	document.getElementById('overlay_door_styles').style.height = arrayPageSize[1] +"px";
	opacity('overlay_door_styles', 0, 70, 1000);	
}

pic2 = new Image(192,25);
	pic2.src = 'http://www.greenteadesign.com/phppages/images/moreroomsn3.gif';
	pic3 = new Image(192,25);
	pic3.src = 'http://www.greenteadesign.com/phppages/images/moreroomsa2.gif';

	var timerID = 0;

	function show_rooms(){
		clearTimeout(timerID);
		document.getElementById('moreroomsdiv').style.visibility='visible';
		newImage = "url(http://www.greenteadesign.com/phppages/images/moreroomsa2.gif)";
    document.getElementById('morerooms').style.backgroundImage = newImage;
	}	
	function hide_rooms(){
		document.getElementById('moreroomsdiv').style.visibility='hidden';
		newImage = "url(http://www.greenteadesign.com/phppages/images/moreroomsn3.gif)";
    document.getElementById('morerooms').style.backgroundImage = newImage;
	}	
	function hide_rooms_wtimeout(){
		timerID = setTimeout("hide_rooms()", 1000);
	}

var moreSLinks = ['<li><a href="http://www.greenteadesign.com/antique-oriental-furniture.html">antique furniture</a></li>', '<li><a href="http://www.greenteadesign.com/home-accessories.html">home accessories</a></li>', '<li><a href="http://www.greenteadesign.com/solid-wood-furniture.html">model suites</a></li>', '<li><a href="http://www.greenteadesign.com/asian-furniture.html">furniture by category</a></li>', '<li><a href="http://www.greenteadesign.com/japanese-furniture.html">furniture by room</a></li>', '<li><a href="http://www.greenteadesign.com/furniture-by-collection.html">furniture by collection</a></li>', '<li><a href="http://www.greenteadesign.com/information/meet-greentea.html">about us</a></li>'];	


function enlargeWindow(){
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}

function contactPage() { 
location.href = 'http://www.greenteadesign.com/phppages/contact.php';
}

function showroomPage() { 
location.href = 'http://www.greenteadesign.com/about/showroom.html';
}

function faqPage() { 
location.href = 'http://www.greenteadesign.com/information/faq1.html';
}

function aboutPage() { 
location.href = 'http://www.greenteadesign.com/about-guide/about.html';
}

function orderPage() { 
location.href = 'http://www.greenteadesign.com/information/ordering.php';
}

function faqPage7() { 
location.href = 'http://www.greenteadesign.com/information/faq7.html';
}

function faqPage8() { 
location.href = 'http://www.greenteadesign.com/information/faq8.html';
}

function faqPage10() { 
location.href = 'http://www.greenteadesign.com/information/faq10.html';
}


function wishlistPage() { 
location.href = 'http://www.greenteadesign.com/phppages/wishlist_step1.php?c=updated';
}


function shippingPage() { 
location.href = 'http://www.greenteadesign.com/information/shipping.php';
}

function shippingPage_quote(prname) { 
location.href = 'http://www.greenteadesign.com/information/shipping.php?product='+prname;
}

function bedroomPage() { 
location.href = 'http://www.greenteadesign.com/contemporary-bedroom-furniture.html';
}
function livingPage() { 
location.href = 'http://www.greenteadesign.com/contemporary-living-room-furniture.html';
}
function kcPage() { 
location.href = 'http://www.greenteadesign.com/kitchen-cabinets.html';
}
function diningPage() { 
location.href = 'http://www.greenteadesign.com/dining-room-furniture.html';
}
function officePage() { 
location.href = 'http://www.greenteadesign.com/home-office-furniture.html';
}
function bathPage() { 
location.href = 'http://www.greenteadesign.com/bathroom-furniture.html';
}
function antPage() { 
location.href = 'http://www.greenteadesign.com/antique-oriental-furniture.html';
}
function collectionPage() { 
location.href = 'http://www.greenteadesign.com/furniture-by-collection.html';
}
function gotoTablesPage(){
location.href = 'http://www.greenteadesign.com/solid-wood-tables.html';
}
function gotoEntertainmentCentersPage(){
location.href = 'http://www.greenteadesign.com/entertainment-centers.html';
}
function gotoSeatingPage(){
location.href = 'http://www.greenteadesign.com/antique-chinese-chairs.html';
}
function gotoStoragePage(){
location.href = 'http://www.greenteadesign.com/shelving-storage-furniture.html';
}
function gotoHomeAccessoriesPage(){
location.href = 'http://www.greenteadesign.com/home-accessories.html';
}
function gotoSideboardsPage(){
location.href = 'http://www.greenteadesign.com/sideboards-and-hutches.html';
}
function gotoStepChestsPage(){
location.href = 'http://www.greenteadesign.com/unique-furniture.html';
}


function hilite(item){
	document.getElementById('under_it_' + item).style.color = 'blue';
	document.getElementById('picced_' + item).style.border = 'solid 1px #000';			
}
function de_hilite(item){
	document.getElementById('under_it_' + item).style.color = '#434343';
	document.getElementById('picced_' + item).style.border = 'solid 1px #b9b9b9';				
}
	var timerID = 0;

	function show_rooms(){
		clearTimeout(timerID);
		document.getElementById('moreroomsdiv').style.visibility='visible';		
	}	
	function hide_rooms(){
		document.getElementById('moreroomsdiv').style.visibility='hidden';		
	}	
	function hide_rooms_wtimeout(){
		timerID = setTimeout("hide_rooms()", 1000);
	}
	
function openWin(){
	newwindow2=window.open('http://www.greenteadesign.com/phppages/privacy-policy.html','win','height=500,width=450,resizable=yes,scrollbars=yes,status=yes');
	}	