/////////////////////////////////////////////////////////////////////////////

/*  Scripts/plugins in here in this order
 *   1. Example plugin (Search example)
 *   2. ifixpng
 *   3. Thickbox - If you need to edit it's: thickbox-compressed same dir
 *   4. Our custom from alm_jquery
 *   5. Background animations plugin
 */
 
/////////////////////////////////////////////////////////////////////////////
 
 
 /*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

			fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
		}
	});

	// Color Conversion functions from highlightFade
	// By Blair Mitchelmore
	// http://jquery.offput.ca/highlightFade/

	// Parse strings looking for color tuples [255,255,255]
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	
	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break; 

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};
	
	// Some named colors to work with
	// From Interface by Stefan Petre
	// http://interface.eyecon.ro/

	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],
		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};
	
})(jQuery);

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 /*
 * jQuery Form Example Plugin 1.4.1
 * Populate form inputs with example text that disappears on focus.
 *
 * e.g.
 *  $('input#name').example('Bob Smith');
 *  $('input[@title]').example(function() {
 *    return $(this).attr('title');
 *  });
 *  $('textarea#message').example('Type your message here', {
 *    className: 'example_text'
 *  });
 *
 * Copyright (c) Paul Mucur (http://mucur.name), 2007-2008.
 * Dual-licensed under the BSD (BSD-LICENSE.txt) and GPL (GPL-LICENSE.txt)
 * licenses.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
(function(A){A.fn.example=function(E,C){var D=A.isFunction(E);var B=A.extend({},C,{example:E});return this.each(function(){var F=A(this);if(A.metadata){var G=A.extend({},A.fn.example.defaults,F.metadata(),B)}else{var G=A.extend({},A.fn.example.defaults,B)}if(!A.fn.example.boundClassNames[G.className]){A(window).unload(function(){A("."+G.className).val("")});A("form").submit(function(){A(this).find("."+G.className).val("")});A.fn.example.boundClassNames[G.className]=true}if(A.browser.msie&&!F.attr("defaultValue")&&(D||F.val()==G.example)){F.val("")}if(F.val()==""&&this!=document.activeElement){F.addClass(G.className);F.val(D?G.example.call(this):G.example)}F.focus(function(){if(A(this).is("."+G.className)){A(this).val("");A(this).removeClass(G.className)}});F.blur(function(){if(A(this).val()==""){A(this).addClass(G.className);A(this).val(D?G.example.call(this):G.example)}})})};A.fn.example.defaults={className:"example"};A.fn.example.boundClassNames=[]})(jQuery);
/*
 * jQuery ifixpng plugin
 * (previously known as pngfix)
 * Version 2.1  (23/04/2008)
 * @requires jQuery v1.1.3 or above
 *
 * Examples at: http://jquery.khurshid.com
 * Copyright (c) 2007 Kush M.
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
 (function(b){b.ifixpng=function(c){b.ifixpng.pixel=c};b.ifixpng.getPixel=function(){return b.ifixpng.pixel||"/images/template_support/pixel.gif"};var a={ltie7:b.browser.msie&&b.browser.version<7,filter:function(c){return"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+c+"')"}};b.fn.ifixpng=a.ltie7?function(){return this.each(function(){var c=b(this);var e=b("base").attr("href");if(e){e=e.replace(/\/[^\/]+$/,"/")}if(c.is("img")||c.is("input")){if(c.attr("src")){if(c.attr("src").match(/.*\.png([?].*)?$/i)){var d=(e&&c.attr("src").search(/^(\/|http:)/i))?e+c.attr("src"):c.attr("src");c.css({filter:a.filter(d),width:c.width(),height:c.height()}).attr({src:b.ifixpng.getPixel()}).positionFix()}}}else{var f=c.css("backgroundImage");if(f.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)){f=RegExp.$1;f=(e&&f.substring(0,1)!="/")?e+f:f;c.css({backgroundImage:"none",filter:a.filter(f)}).children().children().positionFix()}}})}:function(){return this};b.fn.iunfixpng=a.ltie7?function(){return this.each(function(){var c=b(this);var d=c.css("filter");if(d.match(/src=["']?(.*\.png([?].*)?)["']?/i)){d=RegExp.$1;if(c.is("img")||c.is("input")){c.attr({src:d}).css({filter:""})}else{c.css({filter:"",background:"url("+d+")"})}}})}:function(){return this};b.fn.positionFix=function(){return this.each(function(){var d=b(this);var c=d.css("position");if(c!="absolute"&&c!="relative"){d.css({position:"relative"})}})}})(jQuery);
/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
var tb_pathToImage = "images/loadingAnimation.gif";
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}));

/**
 * @author Alexander Farkas
 * v. 1.1
 */

(function($){
	
	if(!document.defaultView || !document.defaultView.getComputedStyle){
		var oldCurCSS = jQuery.curCSS;
		jQuery.curCSS = function(elem, name, force){
			if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
				return oldCurCSS.apply(this, arguments);
			}
			var style = elem.style;
			if ( !force && style && style[ name ] ){
				return style[ name ];
			}
			return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
		};
	}
})(jQuery);

(function($) {
	
	function toArray(strg){
		strg = strg.replace(/left|top/g,'0px');
		strg = strg.replace(/right|bottom/g,'100%');
		strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
		var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
		return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
	}
	
	$.fx.step. backgroundPosition = function(fx) {
		if (!fx.bgPosReady) {
			
			var start = $.curCSS(fx.elem,'backgroundPosition');
			if(!start){//FF2 no inline-style fallback
				start = '0px 0px';
			}
			
			start = toArray(start);
			fx.start = [start[0],start[2]];
			
			var end = toArray(fx.options.curAnim.backgroundPosition);
			fx.end = [end[0],end[2]];
			
			fx.unit = [end[1],end[3]];
			fx.bgPosReady = true;
		}
		
		var nowPosX = [];
		nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
		nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
		fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

	};
})(jQuery);

/* 
    Make changes to file alm_jquery_unpk.js
    Then minimize the codewith YUI compressor online: http://www.refresh-sf.com/yui/
    and paste below:
	
	a la mode jQuery code
*/
var removeTbOpenDrawer = function() { 
	tb_remove(); 
	jQuery('.open_drawer').click(); 
}
function openWin(URL) {awindow = window.open(URL,"thewindow", "width = 490, height = 404, scrollbars = no, status = no, resizable = no, menubar = no, location = no");}; $(document).ready(function(){$('select#relatedProducts').change(function(){window.location = $(this).val();});$('.chatBtn a').click(function(){ openWin( $(this).attr('href') ); return false;  });$('#rightLinks div:eq(1)').css({ width: 180+'px'});$("#freeform input").focus(function(){$(this).parent("label").addClass("highlight")}).blur(function(){$(this).parent("label").removeClass("highlight")});$("img[@src$j=.png]").ifixpng();jQuery.fn.fadeToggle=function(a,c,b){return this.animate({opacity:"toggle"},a,c,b)};$("#search_box").example("Search");$("#phoneNum").css({cursor:"pointer"});$("#phoneNum").hover(function(){$(this).text("252-6633")},function(){$(this).text("ALAMODE")});$(".open_drawer").removeAttr("href");$(".open_drawer_body").removeAttr("href");$(".open_drawer_questions").attr({href: '#'});$(".open_drawer").click(function(){$(this).parent("li.boxParent").find(".box").fadeIn("slow");$(".open_drawer img").animate({opacity:1},1)});$(".open_drawer_body").click(function(){$(".box:not(.questions)").fadeIn("slow")});$(".open_drawer_questions").click(function(){$(".questions").fadeIn("slow")});$(".box-inner h2 a").click(function(){$(".box").fadeOut("slow")});$(".box ul").hover(function(){$(this).css({backgroundColor:"#F6F6F6"})},function(){$(this).css({backgroundColor:"#fff"})});$("img.rollover").hover(function(){var a=$(this).attr("src").replace(/^(.*?)(\.(?:gif|jpg|png))$/,"$1Ovr$2");$(this).attr("src",a)},function(){var a=$(this).attr("src").replace("Ovr","");$(this).attr("src",a)});$("#cta li img").hover(function(){$(this).animate({opacity:0.7},250)},function(){$(this).animate({opacity:1},100)})});$(function(){if($.browser.msie&&parseInt($.browser.version)<7){$("#buttons li").hover(function(){$(this).addClass("sf")},function(){$(this).not("#productSuite").removeClass("sf")})}$("ul.children").hover(function(){$(this).parent("li").find("a:first").css({backgroundColor:"#E7E7E7",color:"#444",textDecoration:"underline"}).end()},function(){$(this).parent("li").find("a:first").attr("style","")});now=new Date();hour=now.getHours();if(hour>8&&hour<18){$(".chat").show()}else{$(".chat").hide()}});

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};


jQuery.openWin = function(url) {
	window.open(url,"thewindow", "width = 490, height = 404, scrollbars = no, status = no, resizable = no, menubar = no, location = no");
}
$(document).ready(function() {		
		
		$('a[href$=.pdf]').attr({target: '_blank'});
		
	    $('#chatnow').click(function() {
		
			 $.openWin('http://livechat.alamode.com/SightMaxAgentInterface/PreChatSurvey.aspx?accountID=1&siteID=1&queueID=6&skipSurvey=yes');
			return false;
	    });
	    
		// WT GRID STYLES
		$('div.wtgrid:even').css({marginRight: 0});
	    $('div.wtgrid:odd').css({marginRight: 50+'px'});
	    $('#bd.wt').css({background:'url(/ee/images/template_support/footer_greyDot.gif) repeat-y 49% 0%' });
		
		$('.idxbuybutton').click(function() {							  
			var idxAnchor = $('.idxbuybutton').attr('href');
			tb_show("",idxAnchor,"");
					return false;					  
		});
		
		// END WT GRID STYLES
		
		
		$('.alagal').css({cursor: 'pointer'});
		var defaultScreenPath = $('.alagal').find('img').attr('src');
		var prd_id = $('.alagal img').attr('title');
		
		if(defaultScreenPath) {
			defaultScreenPath = defaultScreenPath.substr(0,36) + 'with_slideshow_buttons/' + prd_id + 'Screen.jpg';
		    $('.alagal img').attr({src: defaultScreenPath});
		} else {
			
		}
		
	$('.alagal').click(function() {
		  
		  /* Determine the width of the users window */
		  var $initNum = $(this).attr('rel') || 0;	
		  var docWidth =  700; //$(document).width()  This is set to 700 temporarily until we upload the larger screens
		  var alagalXML = $('.alagal').attr('title');
		  							
		  // Set the variable for the width of the gallery	 
		  if(docWidth <= 920) {
			alagal_width = 720; // Set to narrow version	 
			alagal_height = 525; 
			
		  } else {
			alagal_width = 920; // Set to wide version
			alagal_height = 656;
			alagalXML = alagalXML+'\/lrg';
		  }
		  		  
		  // Build the gallery structure
		  $('body')
		  .append('<div class="black_overlay" />')
		  .append('<div class="white_content" />') 
		  .fadeIn();
		  
		  var html =  '<a id="alagal_close" style="cursor: pointer;">Close Gallery</a>';
		  	  html += '<div id="gallery-container">';

		      html += '<div id="gallery-message">Questions? Call 1-800-ALAMODE</div>';
		      html += '<div id="gallery-nav">';
		      
			  html += '<a style="cursor: pointer;"><img height="26" border="0" width="26" id="gallery-prev" src="/_webcreative/_Ray/gallery/images/arrow-left.gif" /></a>';
			  
			  html += '<ul id="slides"></ul>';
			  
			  html += '<a style="cursor: pointer;"><img height="26" border="0" width="26" id="gallery-next" src="/_webcreative/_Ray/gallery/images/arrow-right.gif" /></a>';
			  html += '<a id="gallery-cta" style="cursor: pointer;"><img src="/_webcreative/_Ray/gallery/images/buynow.gif" border="0" /></a>';
			  html += '</div>';
			  html += '<h3></h3>';
			  html += '<p></p>';
			  html += '<div id="screenshot"></div>';
			  html += '</div>';


		$(window).scroll(function () { 
      		$('.black_overlay').css({position:'fixed', height: 100+'%'});
  	  	});
		
		$('#slides li a, #gallery-cta, #gallery-next, #gallery-prev').css({cursor: 'pointer'});
			
		  // Append the structure to the Lightbox	  
		  $('.white_content').append(html).css({width: alagal_width+'px', marginLeft: -alagal_width/2, top: 65+'px'});		  		  
		  // Size and position the numbered nav container
		  var slidesWidth = $('#slides').width() - 170;
		  $('#slides').css({
		  	 left: 36+'px',
			 marginLeft: 0+'px',
			 margin: 0+'px',
			 marginTop: 0+'px',
	      	 width: slidesWidth+'px'		 
		  });	
	  	  
		
	     $('#gallery-cta').click(function() {
			$('#slides li').remove();
			$('.white_content, .black_overlay, #alagal_close').fadeOut('fast').remove();
			$('.box').show();
		 });

		  // Remove Overlay and Gallery
		  $('#alagal_close, .black_overlay').click(function() {
			$('#slides li').remove();
			$('.white_content, .black_overlay, #alagal_close').fadeOut('fast').remove();
		  });	
		  
		//BK
		$.get(alagalXML, function(data) {
			var dataLength = $(data).find('item').length;
			
			if($initNum != 0){
						
					if($initNum > dataLength)
					{
						$initNum = 0;	
					}
					else
					{	
						$initNum = $initNum - 1;	
					}
			} 
			var btnType = $(data).find('items').eq($initNum).attr('buyButton'); // Stores the button type in a variable for separate link and 
	        var demoCode = $(data).find('items').eq($initNum).attr('demo');
			var initPath = $(data).find('item').eq($initNum).attr('path');
			var initTitle = $(data).find('item').eq($initNum).find('title').text();
			var initCaption = $(data).find('item').eq($initNum).find('caption').text();	
		    var sHeight = $(data).find('item').eq($initNum).attr('height'); // Get the height of the default slide
			

			
			var sWidth = $(data).find('item').eq($initNum).attr('width'); // Get the width of the default slide
			$('#screenshot').css({width: 100+'%', height: sHeight+'px'}); // Apply the width and height to the image container	
	
		// Create the numbered navigation	
			$(data).find('item').each(function(index) {
				index = index+1;
				var initPath = $(data).find('item').eq(index-1).attr('path');
				var numhtml = '<li>';
					numhtml += '<a style="cursor: pointer;">' + index + '</a>';
					numhtml += '<img src="'+initPath+'" width="'+ parseInt(sWidth * .25) +'" height="'+ parseInt(sHeight * .25) +'" class="previewThumb" style="left:-'+parseInt(sWidth*.25)/2+'px" \/>';
					numhtml += '</li>';
				$('#slides').append($(numhtml));
			});
		
				// Load initial image, title, and caption
			$('#gallery-container h3').html(initTitle);
			$('#gallery-container p').html(initCaption);		
			$('#screenshot').html('<img src="'+initPath+'" class="screen" />');
			$('#slides li a').eq($initNum).addClass('current');  		

				
		// Numbered nav click events
		   $('#slides li a').click(function() {
           
			   $(this).parent().find('.previewThumb').fadeOut('fast'); // Get rid of thumb 
			   var imageIndex = parseInt($(this).text()); // Return the equivalent XML child node number of the link clicked
			   var idxLoc = imageIndex-1;
			   var screenHeight = $(data).find('item').eq(imageIndex-1).attr('height');
			   $('#screenshot').css({width: 100+'%', height: screenHeight+'px'});
			   var imagePath = $(data).find('item').eq(imageIndex-1).attr('path'); // Get the image path of that node
			   var html = '<img src="'+imagePath+'" class="screen" />';
			   $('#gallery-container h3').html($(data).find('item').eq(imageIndex-1).find('title').text());
			   $('#gallery-container p').html($(data).find('item').eq(imageIndex-1).find('caption').text());
														   
			   $('#slides li a').removeClass(); // Remove any class on the nav anchors
			   $(this).addClass('current'); //	Add the current class to the link that was clicked		
		  
			   $('#screenshot').empty().append(html);
				}).hoverIntent(function() {
			
					$(this).parent().find('.previewThumb').fadeIn('fast');	
	
				},function() {
					
					$(this).parent().find('.previewThumb').fadeOut('fast');
			
			});
			
		
		$('#gallery-next, #gallery-prev').click(function() {
		
		if(!($('#slides li a').hasClass('current'))) 
		{
			$('#slides li a').eq(0).addClass('current');
		}
		
		

		
		});
		
		
		// Prev/Next controls
		$('#gallery-next').click(function() {
			var currentSlide = parseInt($('#slides li a.current').text()); // Detect current slide
			var nSlide = currentSlide + 1;
			var pSlide = currentSlide - 1;
			var slideLength = $(data).find('item').length;
			var sHeight = $(data).find('item').eq(currentSlide).attr('height');
			if (currentSlide == slideLength) 
			{
				var sHeight = $(data).find('item').eq(0).attr('height');
				$('#slides li a').removeClass();
				$('#gallery-container h3').html(initTitle);
				$('#gallery-container p').html(initCaption);		
				$('#screenshot').html('<img src="'+initPath+'" class="screen" />');
				$('#slides li a').eq(0).addClass('current');  	
				$('#screenshot').css({width: 100+'%', height: sHeight+'px'});
			} 
			else if (nSlide == slideLength)
			{
				$('#slides li a').removeClass();
				$('#gallery-container h3').html($(data).find('item').eq(currentSlide).find('title').text());
				$('#gallery-container p').html($(data).find('item').eq(currentSlide).find('caption').text());		
				$('#screenshot').html('<a href="'+demoCode+'"><img src="'+$(data).find('item').eq(currentSlide).attr('path')+'" class="screen" /></a>');
				$('#slides li a').eq(currentSlide).addClass('current'); 
			
				$('#screenshot').css({width: 100+'%', height: sHeight+'px'});
			} 		
			else
			{
				$('#slides li a').removeClass();
				$('#gallery-container h3').html($(data).find('item').eq(currentSlide).find('title').text());
				$('#gallery-container p').html($(data).find('item').eq(currentSlide).find('caption').text());		
				$('#screenshot').html('<img src="'+$(data).find('item').eq(currentSlide).attr('path')+'" class="screen" />');
				$('#slides li a').eq(currentSlide).addClass('current'); 
				$('#screenshot').css({width: 100+'%', height: sHeight+'px'});
			} 		
			
		
		
		});
		
		$('#gallery-prev').click(function() {
			var currentSlide = parseInt($('#slides li a.current').text()); // Detect current slide
			var lastSlide = $(data).find('item').length-1;
		    var sHeight = $(data).find('item').eq(currentSlide-2).attr('height');
			
			
			if (currentSlide == 1) 
			{
				var sHeight = $(data).find('item').eq(lastSlide).attr('height');
				$('#slides li a').removeClass();
				$('#gallery-container h3').html($(data).find('item').eq(lastSlide).find('title').text());
				$('#gallery-container p').html($(data).find('item').eq(lastSlide).find('caption').text());		
				$('#screenshot').html('<a href="'+demoCode+'"><img src="'+$(data).find('item').eq(lastSlide).attr('path')+'" class="screen" /></a>');
				$('#slides li a').eq(lastSlide).addClass('current');
				$('#screenshot').css({width: 100+'%', height: sHeight+'px'});
			} 
			else
			{
				
				
				$('#slides li a').removeClass();
				$('#gallery-container h3').html($(data).find('item').eq(currentSlide-2).find('title').text());
				$('#gallery-container p').html($(data).find('item').eq(currentSlide-2).find('caption').text());		
			
					$('#screenshot').html('<img src="'+$(data).find('item').eq(currentSlide-2).attr('path')+'" class="screen" />');	
			
				
				
				$('#slides li a').eq(currentSlide-2).addClass('current');
				$('#screenshot').css({width: 100+'%', height: sHeight+'px'});
			} 
		
		
		});
			
    
	});
		
		  
			
		  
		  
		  
		
	return false;
		  
	});	
		  
	
		
	/*	
	
			
	
*/

	
});