function popEmail(param) {
	a = window.open('email_popup.php?'+param,'email','height=570,width=500,scrolling=no');
	a.focus();
}

var domain = "neidhardtinc.com";

function emailsales() {
	locationstring = "mailto:" + "sales" + "@" + domain;
	window.location = locationstring;
}

var path = "images/";

function getAbsolutePosition(element) {
  var r = { x: element.offsetLeft, y: element.offsetTop }; 
  if (element.offsetParent) {
    var tmp = getAbsolutePosition(element.offsetParent);
    r.x += tmp.x;
    r.y += tmp.y;
  }
  return r;
};

lastFloatElement = null;
function floatText(element, text, offset_x, offset_y, text_width, color, url) {
	removeFloatText();
	if (lastFloatElement != null) {
		fade_in(lastFloatElement);
	}
	
	var text_div = document.createElement("a");
	text_div.innerHTML = text;
	text_div.id = "floating_text";
	text_div.style.position = "absolute";
	text_div.style.color = color;
	text_div.href = url;
	
	var e_pos = getAbsolutePosition(element);
	
	text_div.style.left = (offset_x + e_pos.x) + "px";
	text_div.style.top = (offset_y + e_pos.y) + "px";
	text_div.style.width = text_width;
	document.body.appendChild(text_div);
	
	lastFloatElement = element;
	fade_out(lastFloatElement);
}

function addStaticFloatText(element, text, offset_x, offset_y, text_width, color, url) {
	var text_div = document.createElement("a");
	text_div.innerHTML = text;
	text_div.style.position = "absolute";
	text_div.style.color = color;
	text_div.href = url;
	
	var e_pos = getAbsolutePosition(element);
	
	text_div.style.left = (offset_x + e_pos.x) + "px";
	text_div.style.top = (offset_y + e_pos.y) + "px";
		
	text_div.style.textAlign = "left";
	text_div.style.width = text_width;
	document.body.appendChild(text_div);	
}

function removeFloatText() {
	var text_div = document.getElementById("floating_text");
	if (text_div != null) {
  	document.body.removeChild(text_div);
	}
}

function roll(name,state,type) {
	var it = (type=="j") ? "jpg":"gif";
	document.images[name].src=path+name+"_"+state+"."+it;
}

function dropFocus(focused_obj) {
	focused_obj.blur();
	focused_obj.hideFocus = true;
	focused_obj.style.outline = 'none';
}

function fade_out(img) {
	img.style.opacity = .25;
  img.style["-moz-opacity"] = 1;
	img.style.filter = "alpha(opacity=25)";
}

function fade_in(img) {
	img.style.opacity = 1;
	img.style["-moz-opacity"] = 1;
  img.style.filter = "alpha(opacity=100)";
}

var pages = new Array('index','aboutus','bio','bio2','stock','customstock','customfixtures','newadditions','featureddetail','catalogcollection','catalogcollection2','catalogcollection_viewall','catalogdetail','restaurantindex','restaurantdetail','installationlist','highlights','joinlist');

function getNextPage() {
	var currentpage = document.location.href.split('/');
	var thispage = currentpage[currentpage.length-1].split('.');
	var page = thispage[0];
	
	for(i=0;i<pages.length;i++) {
		if (page=="joinlist") {document.location.href=pages[0]+".html";}
		else if(pages[i]==page) {document.location.href=pages[i+1]+'.html';}
	}
}

var empty = "";

function signup() {
	var address=document.forms['doemail'].emailsignup.value;
	document.location.href = "joinlist.php?email="+address;
}

function popStock(id) {
	window.open('popup.html?id='+id,"Neidhardt","width=475,height=635,noresize,resizable='no',statusbar='no',top=100,left=350");
}
