// MSDropDown - jquery.dd.js
// author: Marghoob Suleman - Search me on google
// Date: 12th Aug, 2009
// Version: 2.36 {date: 18 Dec, 2010}
// Revision: 31
// web: www.giftlelo.com | www.marghoobsuleman.com
/*
// msDropDown is free jQuery Plugin: you can redistribute it and/or modify
// it under the terms of the either the MIT License or the Gnu General Public License (GPL) Version 2
*/
;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}(';(5($){3 1J="";3 34=5(p,q){3 r=p;3 s=1b;3 q=$.35({1g:3S,2g:7,3a:23,1K:11,1L:3T,3b:\'1Y\',1M:15,3c:\'3U\',2A:\'\',1k:\'\'},q);1b.1U=2h 3d();3 t="";3 u={};u.2B=11;u.2i=15;u.2j=1m;3 v=15;3 w={2C:\'3V\',1N:\'3W\',1O:\'3X\',1P:\'3Y\',1f:\'3Z\',2D:\'41\',2E:\'42\',43:\'44\',2k:\'45\',3e:\'46\'};3 x={1Y:q.3b,2F:\'2F\',2G:\'2G\',2H:\'2H\',1q:\'1q\',1j:.30,2I:\'2I\',2l:\'2l\',2m:\'2m\'};3 y={3f:"2n,2J,2K,1Q,2o,2p,1r,1B,2q,1R,47,1Z,2L",48:"1C,1s,1j,49"};1b.1D=2h 3d();3 z=$(r).12("19");4(3g(z)=="1a"||z.1c<=0){z="4a"+$.1S.3h++;$(r).12("19",z)};3 A=$(r).12("1k");q.1k+=(A==1a)?"":A;3 B=$(r).3i();v=($(r).12("1C")>1||$(r).12("1s")==11)?11:15;4(v){q.2g=$(r).12("1C")};3 C={};3 D=5(a){18 z+w[a]};3 E=5(a){3 b=a;3 c=$(b).12("1k");18 c};3 F=5(a){3 b=$("#"+z+" 2r:8");4(b.1c>1){1t(3 i=0;i<b.1c;i++){4(a==b[i].1h){18 11}}}1d 4(b.1c==1){4(b[0].1h==a){18 11}};18 15};3 G=5(a,b,c,d){3 e="";3 f=(d=="2M")?D("2E"):D("2D");3 g=(d=="2M")?f+"2N"+(b)+"2N"+(c):f+"2N"+(b);3 h="";3 i="";4(q.1M!=15){i=\' \'+q.1M+\' \'+a.3j}1d{h=$(a).12("1V");h=(h.1c==0)?"":\'<3k 3l="\'+h+\'" 3m="3n" /> \'};3 j=$(a).1o();3 k=$(a).4b();3 l=($(a).12("1j")==11)?"1j":"21";C[g]={1E:h+j,22:k,1o:j,1h:a.1h,19:g};3 m=E(a);4(F(a.1h)==11){e+=\'<a 3o="3p:3q(0);" 1p="8 \'+l+i+\'"\'}1d{e+=\'<a  3o="3p:3q(0);" 1p="\'+l+i+\'"\'};4(m!==15&&m!==1a){e+=" 1k=\'"+m+"\'"};e+=\' 19="\'+g+\'">\';e+=h+\'<1u 1p="\'+x.1q+\'">\'+j+\'</1u></a>\';18 e};3 H=5(){3 f=B;4(f.1c==0)18"";3 g="";3 h=D("2D");3 i=D("2E");f.2O(5(c){3 d=f[c];4(d.4c=="4d"){g+="<1v 1p=\'4e\'>";g+="<1u 1k=\'3r-4f:4g;3r-1k:4h; 4i:4j;\'>"+$(d).12("4k")+"</1u>";3 e=$(d).3i();e.2O(5(a){3 b=e[a];g+=G(b,c,a,"2M")});g+="</1v>"}1d{g+=G(d,c,"","")}});18 g};3 I=5(){3 a=D("1N");3 b=D("1f");3 c=q.1k;1W="";1W+=\'<1v 19="\'+b+\'" 1p="\'+x.2H+\'"\';4(!v){1W+=(c!="")?\' 1k="\'+c+\'"\':\'\'}1d{1W+=(c!="")?\' 1k="2s-1w:4l 4m #4n;1x:2t;1y:2P;\'+c+\'"\':\'\'};1W+=\'>\';18 1W};3 J=5(){3 a=D("1O");3 b=D("2k");3 c=D("1P");3 d=D("3e");3 e="";3 f="";4(6.9(z).1F.1c>0){e=$("#"+z+" 2r:8").1o();f=$("#"+z+" 2r:8").12("1V")};f=(f.1c==0||f==1a||q.1K==15||q.1M!=15)?"":\'<3k 3l="\'+f+\'" 3m="3n" /> \';3 g=\'<1v 19="\'+a+\'" 1p="\'+x.2F+\'"\';g+=\'>\';g+=\'<1u 19="\'+b+\'" 1p="\'+x.2G+\'"></1u><1u 1p="\'+x.1q+\'" 19="\'+c+\'">\'+f+\'<1u 1p="\'+x.1q+\'">\'+e+\'</1u></1u></1v>\';18 g};3 K=5(){3 c=D("1f");$("#"+c+" a.21").1I("1Q");$("#"+c+" a.21").1e("1Q",5(a){a.24();N(1b);4(!v){$("#"+c).1I("1B");P(15);3 b=(q.1K==15)?$(1b).1o():$(1b).1E();T(b);s.25()};X()})};3 L=5(){3 d=15;3 e=D("1N");3 f=D("1O");3 g=D("1P");3 h=D("1f");3 i=D("2k");3 j=$("#"+z).2Q();j=j+2;3 k=q.1k;4($("#"+e).1c>0){$("#"+e).2u();d=11};3 l=\'<1v 19="\'+e+\'" 1p="\'+x.1Y+\'"\';l+=(k!="")?\' 1k="\'+k+\'"\':\'\';l+=\'>\';l+=J();l+=I();l+=H();l+="</1v>";l+="</1v>";4(d==11){3 m=D("2C");$("#"+m).2R(l)}1d{$("#"+z).2R(l)};4(v){3 f=D("1O");$("#"+f).2v()};$("#"+e).14("2Q",j+"1T");$("#"+h).14("2Q",(j-2)+"1T");4(B.1c>q.2g){3 n=26($("#"+h+" a:3s").14("28-3t"))+26($("#"+h+" a:3s").14("28-1w"));3 o=((q.3a)*q.2g)-n;$("#"+h).14("1g",o+"1T")}1d 4(v){3 o=$("#"+z).1g();$("#"+h).14("1g",o+"1T")};4(d==15){S();O(z)};4($("#"+z).12("1j")==11){$("#"+e).14("2w",x.1j)};R();$("#"+f).1e("1B",5(a){2S(1)});$("#"+f).1e("1R",5(a){2S(0)});K();$("#"+h+" a.1j").14("2w",x.1j);4(v){$("#"+h).1e("1B",5(c){4(!u.2i){u.2i=11;$(6).1e("1Z",5(a){3 b=a.3u;u.2j=b;4(b==39||b==40){a.24();a.2x();U();X()};4(b==37||b==38){a.24();a.2x();V();X()}})}})};$("#"+h).1e("1R",5(a){P(15);$(6).1I("1Z");u.2i=15;u.2j=1m});$("#"+f).1e("1Q",5(b){P(15);4($("#"+h+":3v").1c==1){$("#"+h).1I("1B")}1d{$("#"+h).1e("1B",5(a){P(11)});s.3w()}});$("#"+f).1e("1R",5(a){P(15)});4(q.1K&&q.1M!=15){W()}};3 M=5(a){1t(3 i 2y C){4(C[i].1h==a){18 C[i]}};18-1};3 N=5(a){3 b=D("1f");4($("#"+b+" a.8").1c==1){t=$("#"+b+" a.8").1o()};4(!v){$("#"+b+" a.8").1G("8")};3 c=$("#"+b+" a.8").12("19");4(c!=1a){3 d=(u.1X==1a||u.1X==1m)?C[c].1h:u.1X};4(a&&!v){$(a).1z("8")};4(v){3 e=u.2j;4($("#"+z).12("1s")==11){4(e==17){u.1X=C[$(a).12("19")].1h;$(a).4o("8")}1d 4(e==16){$("#"+b+" a.8").1G("8");$(a).1z("8");3 f=$(a).12("19");3 g=C[f].1h;1t(3 i=2T.4p(d,g);i<=2T.4q(d,g);i++){$("#"+M(i).19).1z("8")}}1d{$("#"+b+" a.8").1G("8");$(a).1z("8");u.1X=C[$(a).12("19")].1h}}1d{$("#"+b+" a.8").1G("8");$(a).1z("8");u.1X=C[$(a).12("19")].1h}}};3 O=5(a){3 b=a;6.9(b).4r=5(e){$("#"+b).1S(q)}};3 P=5(a){u.2B=a};3 Q=5(){18 u.2B};3 R=5(){3 b=D("1N");3 c=y.3f.4s(",");1t(3 d=0;d<c.1c;d++){3 e=c[d];3 f=Y(e);4(f==11){3x(e){1n"2n":$("#"+b).1e("4t",5(a){6.9(z).2n()});1i;1n"1Q":$("#"+b).1e("1Q",5(a){$("#"+z).1H("1Q")});1i;1n"2o":$("#"+b).1e("2o",5(a){$("#"+z).1H("2o")});1i;1n"2p":$("#"+b).1e("2p",5(a){$("#"+z).1H("2p")});1i;1n"1r":$("#"+b).1e("1r",5(a){$("#"+z).1H("1r")});1i;1n"1B":$("#"+b).1e("1B",5(a){$("#"+z).1H("1B")});1i;1n"2q":$("#"+b).1e("2q",5(a){$("#"+z).1H("2q")});1i;1n"1R":$("#"+b).1e("1R",5(a){$("#"+z).1H("1R")});1i}}}};3 S=5(){3 a=D("2C");$("#"+z).2R("<1v 1p=\'"+x.2I+"\' 1k=\'1g:4u;4v:4w;1y:3y;\' 19=\'"+a+"\'></1v>");$("#"+z).4x($("#"+a))};3 T=5(a){3 b=D("1P");$("#"+b).1E(a)};3 U=5(){3 a=D("1P");3 b=D("1f");3 c=$("#"+b+" a.21");1t(3 d=0;d<c.1c;d++){3 e=c[d];3 f=$(e).12("19");4($(e).3z("8")&&d<c.1c-1){$("#"+b+" a.8").1G("8");$(c[d+1]).1z("8");3 g=$("#"+b+" a.8").12("19");4(!v){3 h=(q.1K==15)?C[g].1o:C[g].1E;T(h)};4(26(($("#"+g).1y().1w+$("#"+g).1g()))>=26($("#"+b).1g())){$("#"+b).29(($("#"+b).29())+$("#"+g).1g()+$("#"+g).1g())};1i}}};3 V=5(){3 a=D("1P");3 b=D("1f");3 c=$("#"+b+" a.21");1t(3 d=0;d<c.1c;d++){3 e=c[d];3 f=$(e).12("19");4($(e).3z("8")&&d!=0){$("#"+b+" a.8").1G("8");$(c[d-1]).1z("8");3 g=$("#"+b+" a.8").12("19");4(!v){3 h=(q.1K==15)?C[g].1o:C[g].1E;T(h)};4(26(($("#"+g).1y().1w+$("#"+g).1g()))<=0){$("#"+b).29(($("#"+b).29()-$("#"+b).1g())-$("#"+g).1g())};1i}}};3 W=5(){4(q.1M!=15){3 a=D("1P");3 b=6.9(z).1F[6.9(z).1l].3j;4(b.1c>0){3 c=D("1f");3 d=$("#"+c+" a."+b).12("19");3 e=$("#"+d).14("2a-4y");3 f=$("#"+d).14("2a-1y");3 g=$("#"+d).14("28-3A");4(e!=1a){$("#"+a).2b("."+x.1q).12(\'1k\',"2a:"+e)};4(f!=1a){$("#"+a).2b("."+x.1q).14(\'2a-1y\',f)};4(g!=1a){$("#"+a).2b("."+x.1q).14(\'28-3A\',g)};$("#"+a).2b("."+x.1q).14(\'2a-3B\',\'4z-3B\');$("#"+a).2b("."+x.1q).14(\'28-3t\',\'4A\')}}};3 X=5(){3 a=D("1f");3 b=$("#"+a+" a.8");4(b.1c==1){3 c=$("#"+a+" a.8").1o();3 d=$("#"+a+" a.8").12("19");4(d!=1a){3 e=C[d].22;6.9(z).1l=C[d].1h};4(q.1K&&q.1M!=15)W()}1d 4(b.1c>1){3 f=$("#"+z+" > 2r:8").4B("8");1t(3 i=0;i<b.1c;i++){3 d=$(b[i]).12("19");3 g=C[d].1h;6.9(z).1F[g].8="8"}};3 h=6.9(z).1l;s.1U["1l"]=h};3 Y=5(a){4($("#"+z).12("4C"+a)!=1a){18 11};3 b=$("#"+z).2U("4D");4(b&&b[a]){18 11};18 15};3 Z=5(){3 b=D("1f");4(Y(\'2K\')==11){3 c=C[$("#"+b+" a.8").12("19")].1o;4($.3C(t)!==$.3C(c)&&t!==""){$("#"+z).1H("2K")}};4(Y(\'1r\')==11){$("#"+z).1H("1r")};4(Y(\'2J\')==11){$(6).1e("1r",5(a){$("#"+z).2n();$("#"+z)[0].2J();X();$(6).1I("1r")})}};3 2S=5(a){3 b=D("2k");4(a==1)$("#"+b).14({3D:\'0 4E%\'});1d $("#"+b).14({3D:\'0 0\'})};3 3E=5(){1t(3 i 2y 6.9(z)){4(3g(6.9(z)[i])!=\'5\'&&6.9(z)[i]!==1a&&6.9(z)[i]!==1m){s.1A(i,6.9(z)[i],11)}}};3 3F=5(a,b){4(M(b)!=-1){6.9(z)[a]=b;3 c=D("1f");$("#"+c+" a.8").1G("8");$("#"+M(b).19).1z("8");3 d=M(6.9(z).1l).1E;T(d)}};3 3G=5(i,a){4(a==\'d\'){1t(3 b 2y C){4(C[b].1h==i){4F C[b];1i}}};3 c=0;1t(3 b 2y C){C[b].1h=c;c++}};3 2V=5(){3 a=D("1f");3 b=D("1N");3 c=$("#"+b).1y();3 d=$("#"+b).1g();3 e=$(3H).1g();3 f=$(3H).29();3 g=$("#"+a).1g();3 h={1L:q.1L,1w:(c.1w+d)+"1T",1x:"2c"};3 i=q.3c;3 j=15;3 k=x.2m;$("#"+a).1G(x.2m);$("#"+a).1G(x.2l);4((e+f)<2T.4G(g+d+c.1w)){3 l=c.1w-g;4((c.1w-g)<0){l=10};h={1L:q.1L,1w:l+"1T",1x:"2c"};i="2W";j=11;k=x.2l};18{2X:j,3I:i,14:h,2s:k}};1b.3w=5(){4((s.2d("1j",11)==11)||(s.2d("1F",11).1c==0))18;3 c=D("1f");4(1J!=""&&c!=1J){$("#"+1J).3J("2Y");$("#"+1J).14({1L:\'0\'})};4($("#"+c).14("1x")=="2c"){t=C[$("#"+c+" a.8").12("19")].1o;$(6).1e("1Z",5(a){3 b=a.3u;4(b==39||b==40){a.24();a.2x();U()};4(b==37||b==38){a.24();a.2x();V()};4(b==27||b==13){s.25();X()};4($("#"+z).12("3K")!=1a){6.9(z).3K()}});$(6).1e("2L",5(a){4($("#"+z).12("3L")!=1a){6.9(z).3L()}});$(6).1e("1r",5(a){4(Q()==15){s.25()}});3 d=2V();$("#"+c).14(d.14);4(d.2X==11){$("#"+c).14({1x:\'2t\'});$("#"+c).1z(d.2s);4(s.1D["2z"]!=1m){2e(s.1D["2z"])(s)}}1d{$("#"+c)[d.3I]("2Y",5(){$("#"+c).1z(d.2s);4(s.1D["2z"]!=1m){2e(s.1D["2z"])(s)}})};4(c!=1J){1J=c}}};1b.25=5(){3 b=D("1f");$(6).1I("1Z");$(6).1I("2L");$(6).1I("1r");3 c=2V();4(c.2X==11){$("#"+b).14("1x","2c")};$("#"+b).3J("2Y",5(a){Z();$("#"+b).14({1L:\'0\'});4(s.1D["3M"]!=1m){2e(s.1D["3M"])(s)}})};1b.1l=5(i){s.1A("1l",i)};1b.1A=5(a,b,c){4(a==1a||b==1a)3N{3O:"1A 4H 4I?"};s.1U[a]=b;4(c!=11){3x(a){1n"1l":3F(a,b);1i;1n"1j":s.1j(b,11);1i;1n"1s":6.9(z)[a]=b;v=($(r).12("1C")>0||$(r).12("1s")==11)?11:15;4(v){3 d=$("#"+z).1g();3 f=D("1f");$("#"+f).14("1g",d+"1T");3 g=D("1O");$("#"+g).2v();3 f=D("1f");$("#"+f).14({1x:\'2t\',1y:\'2P\'});K()};1i;1n"1C":6.9(z)[a]=b;4(b==0){6.9(z).1s=15};v=($(r).12("1C")>0||$(r).12("1s")==11)?11:15;4(b==0){3 g=D("1O");$("#"+g).2W();3 f=D("1f");$("#"+f).14({1x:\'2c\',1y:\'3y\'});3 h="";4(6.9(z).1l>=0){3 i=M(6.9(z).1l);h=i.1E;N($("#"+i.19))};T(h)}1d{3 g=D("1O");$("#"+g).2v();3 f=D("1f");$("#"+f).14({1x:\'2t\',1y:\'2P\'})};1i;4J:4K{6.9(z)[a]=b}4L(e){};1i}}};1b.2d=5(a,b){4(a==1a&&b==1a){18 s.1U};4(a!=1a&&b==1a){18(s.1U[a]!=1a)?s.1U[a]:1m};4(a!=1a&&b!=1a){18 6.9(z)[a]}};1b.3v=5(a){3 b=D("1N");4(a==11){$("#"+b).2W()}1d 4(a==15){$("#"+b).2v()}1d{18 $("#"+b).14("1x")}};1b.4M=5(a,b){3 c=a;3 d=c.1o;3 e=(c.22==1a||c.22==1m)?d:c.22;3 f=(c["1V"]==1a||c["1V"]==1m)?\'\':c["1V"];3 i=(b==1a||b==1m)?6.9(z).1F.1c:b;6.9(z).1F[i]=2h 4N(d,e);4(f!=\'\')6.9(z).1F[i]["1V"]=f;3 g=M(i);4(g!=-1){3 h=G(6.9(z).1F[i],i,"","");$("#"+g.19).1E(h)}1d{3 h=G(6.9(z).1F[i],i,"","");3 j=D("1f");$("#"+j).4O(h);K()}};1b.2u=5(i){6.9(z).2u(i);4((M(i))!=-1){$("#"+M(i).19).2u();3G(i,\'d\')};4(6.9(z).1c==0){T("")}1d{3 a=M(6.9(z).1l).1E;T(a)};s.1A("1l",6.9(z).1l)};1b.1j=5(a,b){6.9(z).1j=a;3 c=D("1N");4(a==11){$("#"+c).14("2w",x.1j);s.25()}1d 4(a==15){$("#"+c).14("2w",1)};4(b!=11){s.1A("1j",a)}};1b.2Z=5(){18(6.9(z).2Z==1a)?1m:6.9(z).2Z};1b.31=5(){4(2f.1c==1){18 6.9(z).31(2f[0])}1d 4(2f.1c==2){18 6.9(z).31(2f[0],2f[1])}1d{3N{3O:"4P 1h 4Q 4R!"}}};1b.3P=5(a){18 6.9(z).3P(a)};1b.1s=5(a){4(a==1a){18 s.2d("1s")}1d{s.1A("1s",a)}};1b.1C=5(a){4(a==1a){18 s.2d("1C")}1d{s.1A("1C",a)}};1b.4S=5(a,b){s.1D[a]=b};1b.4T=5(a){2e(s.1D[a])(s)};3 3Q=5(){s.1A("32",$.1S.32);s.1A("33",$.1S.33)};3 3R=5(){L();3E();3Q();4(q.2A!=\'\'){2e(q.2A)(s)}};3R()};$.1S={32:2.36,33:"4U 4V",3h:20,4W:5(a,b){18 $(a).1S(b).2U("1Y")}};$.4X.35({1S:5(b){18 1b.2O(5(){3 a=2h 34(1b,b);$(1b).2U(\'1Y\',a)})}})})(4Y);',62,309,'|||var|if|function|document||selected|getElementById||||||||||||||||||||||||||||||||||||||||||||||||||||||true|attr||css|false|||return|id|undefined|this|length|else|bind|postChildID|height|index|break|disabled|style|selectedIndex|null|case|text|class|ddTitleText|mouseup|multiple|for|span|div|top|display|position|addClass|set|mouseover|size|onActions|html|options|removeClass|trigger|unbind|bh|showIcon|zIndex|useSprite|postID|postTitleID|postTitleTextID|click|mouseout|msDropDown|px|ddProp|title|sDiv|oldIndex|dd|keydown||enabled|value||preventDefault|close|parseInt||padding|scrollTop|background|find|none|get|eval|arguments|visibleRows|new|keyboardAction|currentKey|postArrowID|borderTop|noBorderTop|focus|dblclick|mousedown|mousemove|option|border|block|remove|hide|opacity|stopPropagation|in|onOpen|onInit|insideWindow|postElementHolder|postAID|postOPTAID|ddTitle|arrow|ddChild|ddOutOfVision|blur|change|keyup|opt|_|each|relative|width|after|bj|Math|data|bn|show|opp|fast|form||item|version|author|bi|extend|||||rowHeight|mainCSS|animStyle|Object|postInputhidden|actions|typeof|counter|children|className|img|src|align|absmiddle|href|javascript|void|font|first|bottom|keyCode|visible|open|switch|absolute|hasClass|left|repeat|trim|backgroundPosition|bk|bl|bm|window|ani|slideUp|onkeydown|onkeyup|onClose|throw|message|namedItem|bo|bp|120|9999|slideDown|_msddHolder|_msdd|_title|_titletext|_child||_msa|_msopta|postInputID|_msinput|_arrow|_inp|keypress|prop|tabindex|msdrpdd|val|nodeName|OPTGROUP|opta|weight|bold|italic|clear|both|label|1px|solid|c3c3c3|toggleClass|min|max|refresh|split|mouseenter|0px|overflow|hidden|appendTo|image|no|2px|removeAttr|on|events|100|delete|floor|to|what|default|try|catch|add|Option|append|An|is|required|addMyEvent|fireEvent|Marghoob|Suleman|create|fn|jQuery'.split('|'),0,{}))

function evtTtl(){$('#qty__titletext .ddTitleText').html('SELECT QUANTITY');}
function evtTtl2(){var p=$('.productOptionViewSelect .ddTitleText')[0];
            if(p)$(p).html('SELECT CEILING HEIGHT');
            //Remove the 'select ceiling height' option from the dropdown
            p=$('.productOptionViewSelect .ddChild'),q=p.find('a')[0];
            if(q)q.style.display='none';
}

function evtChange(){
    var q=$('#qty__titletext .ddTitleText'),h=q.html();
    $($('.ddTitle')[0]).removeClass('boldline');
    if(q && h.indexOf('SELECT')<0 && h.indexOf('Quantity ')<0)//if some quantity is selected then prefix 'Quantity '
        q.html('Quantity '+h);
}
function evtChange2(){
    $('.col3fxdht .productOptionViewSelect .ddTitle').removeClass('boldline');
}

$(document).ready(function(){

    //category page scroll content background image setup
    var a=document.location.href;
    if($('.scroll-content')[0]){
	
	if(a.indexOf('categories')>0){
		a=a.substr(a.indexOf('categories')+'categories'.length+1);
		a=a.substr(0,a.indexOf('/'));
	}
	else
	{
		a=a.substr(a.indexOf('.au/')+4).replace('/','');
		if(a.indexOf('zen')>=0)a='CONTEMPORARY-CHANDELIERS';
		else a='TRADITIONAL-CHANDELIERS';
	}
	$('.scroll-content').css('background-image','url(/templates/__custom/images/'+a+'.png)');
    }

    //home page animation
    if($('.homeMainOuter')[0]){
        $('#NavBar .topnav li').removeClass('active');
        $('#NavBar .topnav li:first').addClass('active');
        setTimeout(slideHome,7000);
    }

    var HOME_SLIDE=1;
    function slideHome(){
        var cur=HOME_SLIDE,nxt=cur<3?cur+1:1,out=$('.homeMainOuter'),inn=$('.homeMainInner'),i=inn.css('background-image');     
        HOME_SLIDE=nxt;
        out.css('background-image',i).css('background-position','center top');
        if(!$.browser.msie)out.css('opacity',1);
        if(!$.browser.msie)inn.css('opacity',0)
        inn.css('background-image',i.replace(cur+'.png',nxt+'.png')).css('background-position','200px top');
        if($.browser.msie)
            out.animate({backgroundPosition:'-500px top'},800);
        else
            out.animate({backgroundPosition:'-300px top',opacity:0},800);
        if($.browser.msie)
            inn.animate({backgroundPosition:'50% top'},800);
        else
            inn.animate({backgroundPosition:'50% top',opacity:1},800,function(){inn.css('opacity','')});
        setTimeout(slideHome,5000);
    }
});

$(function() {      

    //make sure drop down parent menu retains mouseover color when dropdown is shown
    $('.bottomnav .sf-vertical>li').hover(function(){$(this).find('a').css('color','#D7B58E')},function(){$(this).find('a').css('color','')});

    //prepend extra space li to dropdowns
    $('.sf-vertical ul').prepend($('<li></li>').addClass('lidummy'));
    
    $('#TopMenu .Cart a').each(function(){$(this).html($(this).html().replace(' items','').replace('  item',''));});

    $('#NavBar li ul').append($('<li>&nbsp;</li>').addClass('lidummybtm').height(24).css('background','url("/templates/__custom/images/menubgmid.png") repeat-y')).append($('<li>&nbsp;</li>').addClass('lidummybtm').height(30).css('background','url("/templates/__custom/images/menubgbtm.png") no-repeat'));
    $($('#NavBar li ul li')[0]).addClass('lifirst');

    var loc=document.location.href.toLowerCase();
    if(loc.indexOf('/categories/')>0){
        $('.bottomnav a').each(function(){
            if(loc.indexOf($(this).html().toLowerCase().replace(' ','-'))>0)
                $(this).parent().addClass('active');
        });
    }
    
    //hide carousel arrows if images are less than or 3
    $('.carousel').each(function(){
    if($(this).find('.thumnail ul')[0]&&$(this).find('.thumnail ul')[0].getElementsByTagName('li').length<=3)$(this).find('.control li').css('visibility','hidden');
    });

    $('.catalogue .ProductDetails').click(
    function(){document.location.href=$(this).prev().find('a').attr('href');}
    )

    var zz=$(".col3 .quantityInput");
    if(zz[0]){
        zz[0].onchange=evtChange;       
    }
    $('.quantityInput').msDropDown({onInit:'evtTtl'});
    
    //add dropdown shadows to select quantity dropdown
    $('.col3fxdht .dd .ddChild').prepend($('<div></div>').css('height',3)).prepend($('<img>').attr('src','/templates/__custom/images/selbg-top.png'))
    $('.col3fxdht .dd .ddChild').append($('<div></div>').css('height',6)).append($('<img>').attr('src','/templates/__custom/images/selbg-btm.png'))

    if($('.col3')[0]){
        $('.productOptionViewSelect select')[0].onchange=evtChange2;
        $('.productOptionViewSelect select').msDropDown({onInit:'evtTtl2'});
        $('.dimensions').html($('.dimensions').html().replace('KGS','kg'));
    }
    //add dropdown shadows to select ceiling height dropdown
    $('.col3fxdht .productOptionViewSelect .dd .ddChild').prepend($('<div></div>').css('height',3)).prepend($('<img>').attr('src','/templates/__custom/images/selbg-top-big.png'))
    $('.col3fxdht .productOptionViewSelect .dd .ddChild').append($('<div></div>').css('height',6)).append($('<img>').attr('src','/templates/__custom/images/selbg-btm-big.png'))

    if(isShopHome()){//showPromo();
    //shopBanner();
    }

    var minWidth = 980;
    var footerHeight = 90;

    function reposBg(size){
        var h=size.h,bgHeight=950,galTop=280,TpPanelTop=24,dy=bgHeight-h;
        if(h<bgHeight){         
            if(dy>100)dy=100;
            
            if($('.presspane')[0]){//if press page
                $('#Wrapper').css('padding-top',galTop-dy-46);
                $('body')[0].style.backgroundPosition='center -'+dy+'px';
            }
            else if($('.scroll-pane')[0]){//if has gallery
                $('#Wrapper').css('padding-top',galTop-dy);             
                $('body')[0].style.backgroundPosition='center -'+dy+'px';
            }
            else if($('#productWraper')[0]){//if product page
                $('#Wrapper').css('padding-top',galTop-dy-20);              
                $('body')[0].style.backgroundPosition='center -'+dy+'px';
            }
            else if($('.contactWrapper')[0] || $('.adviceWrapper')[0]){//if contact page or advice page
                $('#Wrapper').css('padding-top',galTop-dy-20);
                $('body')[0].style.backgroundPosition='center -'+dy+'px';
            }
            else if($('.homeWrapper')[0]){//if home page
                $('#Wrapper').css('padding-top',galTop-dy-46);
                $('body')[0].style.backgroundPosition='center -'+dy+'px';
            }
            else {//all other pages

                var pp=galTop-dy-20;
                $('#Wrapper').css('margin-top',pp).css('padding-top',35).css('background','#F6EFE9');
                $('#Container').css('background','#F6EFE9');
                $('body')[0].style.backgroundPosition='0px -'+dy+'px';
                return pp;
            }

        }else if(!($('.presspane')[0] || $('.scroll-pane')[0] || $('#productWraper')[0] || $('.contactWrapper')[0] || $('.adviceWrapper')[0] || $('.homeWrapper')[0] )){
                var pp=galTop-dy-20;
                $('#Wrapper').css('margin-top',pp).css('padding-top',35).css('background','#F6EFE9');
                $('#Container').css('background','#F6EFE9');
                $('body')[0].style.backgroundPosition='0px -'+dy+'px';
                return pp;
            }
        return 0;
    }

    function checkWindow(){
        var size = getCurrentSize(),pp=reposBg(size);
        if(!pp)//returns true if gallery page or product description page
            $('#Container').height(getCurrentSize().h-15);
        else $('#Container').height(getCurrentSize().h-pp);

        try{        
            $('.homePromoPanel,#TpPanel,.arrbc').removeClass('winLeft');
            $('#TopMenu').removeClass('winRight');
            $('#TopMenu').addClass('cssRight');
            var w0=$(window).width(),w1=$(window).height();
            if(w0>1750){            
                $('.homePromoPanel,#TpPanel,.arrbc').addClass('winLeft');
                $('#TopMenu').removeClass('cssRight');
                $('#TopMenu').addClass('winRight');
            }
            var z3=w1>950?((-925+w1)):0;
            if($('.homePromoPanel')[0])
            $('#NavBar').css('margin-top',$('.homePromoPanel')[0].offsetTop-153-z3);
            else if($('#productWraper')[0])
            $('#NavBar').css('margin-top',$('#productWraper')[0].offsetTop-138-(z3?z3-44:0));
            else if($('#CategoryHeading')[0])
            $('#NavBar').css('margin-top',$('#CategoryHeading')[0].offsetTop-168-(z3?z3-44:0));
            else $('#NavBar').css('margin-top',$('.Content')[0].offsetTop-182-(z3?z3-24:0));
            $('.homeSlider').css('margin-left',(((w0/2)-320)>430)?'':-((w0/2)-320));
        }catch(e){}
    }

    function getCurrentSize(){
        var _obj = new Object();
        if(window.innerHeight){
            _obj.w = window.innerWidth;
            _obj.h = window.innerHeight;
        } else if (document.all && document.getElementById && (document.compatMode=='CSS1Compat')) {
            _obj.w = window.clientWidth;
            _obj.h = document.documentElement.clientHeight;
        } else if(document.body.clientHeight){
            _obj.w = document.body.clientWidth;
            _obj.h = document.body.clientHeight;
        } else {
            _obj.w = document.body.offsetWidth;
            _obj.h = document.body.offsetHeight;
        }
        return _obj;
    }
    function slrMove(dir,val){
        var scrollPane = $('.scroll-pane'),scrollContent = $('.scroll-content'),v;
        if(dir){
            var i=$(".scroll-bar").slider('value'),j=$('.scroll-content li').length-2;
            var k=i+((dir)*((2*100)/j));//Set k so that we want to move 2 images at a time, so 2*100
            v=k>100?100:(k<0?0:k);
            $(".scroll-bar").slider('value',v);
        }else v=val;
        var width = scrollContent.outerWidth() ;
                if( width > scrollPane.width() ) { 
                    jqease(5,0,1);
                    scrollContent.stop().animate({marginLeft:(0 - Math.round( (v / 100) * ( width - scrollPane.width()) ))  + 'px'},2000); 
                } else { 
                    scrollContent.css('margin-left', 0); 
                }
    }
    
    checkWindow();
    $(window).resize(function() {
        checkWindow();
    });

    if ($('.scroll-pane').length != 0) {

        $(document.body).append($('<span class="slrleft"><img src="/templates/__custom/images/left arrow on.png"></span>').click(function(){slrMove(-1);}))
        $(document.body).append($('<span class="slrright"><img src="/templates/__custom/images/right arrow on.png"></span>').click(function(){slrMove(1);}))


        var scrollPane = $('.scroll-pane');
        var scrollContent = $('.scroll-content');
        var scrollContentli = $('.scroll-content li');
        
        var width = scrollContentli.outerWidth() * ( scrollContentli.size() + 1);
        scrollContent.width(width);
        
        //build slider
        var scrollbar = $(".scroll-bar").slider({
            slide:function(e, ui){
                slrMove(0,ui.value);
            }
        });
        scrollPane.css('overflow','hidden');
        
        $(".scroll-content li").hover(
            function() { 
                $(this).children('.ProductDetails').show();
            }, function() {
                $(this).children('.ProductDetails').hide();
            }
        );
    }
    
    
    
    
    if ($('.WishlistProductList li').length != 0) {
        $(".WishlistProductList li").hover(
            function() { 
                $(this).children('.productDetails').show();
            }, function() {
                $(this).children('.productDetails').hide();
            }
        );
    }
          
    if ($('.selectableAmount').length != 0) {
        $(".selectableAmount span").click(
            function() {
                $(this).parent().children('span').removeClass('active');
                $(this).addClass('active');
                var amount = $(this).children('label').html();
                $("#certificate_amount").val(amount);
                $("#giftCertAmountDisplay").html("");
                $("#giftCertAmountDisplay").css('background', 'none');
                switch(amount) {
                    case '250':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_250.png) no-repeat top left');
                        break;
                    case '200':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_200.png) no-repeat top left');
                        break;
                    case '150':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_150.png) no-repeat top left');
                        break;
                    case '100':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_100.png) no-repeat top left');
                        break;
                    default:
                        $("#giftCertAmountDisplay").css('background', 'none');
                        $("#giftCertAmountDisplay").html("Gift $" + amount);
                        break;
                }
            }
        );
    }

    if ($('.setAmountBtn').length != 0) {
        $(".setAmountBtn").click(
            function() {
                var amount = $("#inputAmount").val();
                $("#certificate_amount").val(amount);
                $("#giftCertAmountDisplay").html('&nbsp;');
                switch(amount) {
                    case '250':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_250.png) no-repeat top left');
                        break;
                    case '200':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_200.png) no-repeat top left');
                        break;
                    case '150':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_150.png) no-repeat top left');
                        break;
                    case '100':
                        $("#giftCertAmountDisplay").css('background', 'url(/templates/__custom/images/gift_100.png) no-repeat top left');
                        break;
                    default:
                        $("#giftCertAmountDisplay").css('background', 'none');
                        $("#giftCertAmountDisplay").html("Gift $" + amount);
                        break;
                }
            }
        );
    }
          
    if ($('#productAddToWishList').length != 0) {
        $("#productAddToWishList").click(function(e) {
              e.preventDefault();
              $('#frmWishList').submit();
        });
    }
    
          
    if ($('.colorSelector').length != 0) {
        $('.colorSelector').css('cursor', 'pointer');
        $(".colorSelector").hover(function(e) {//show current mouseover color name
            $('#dressColorName').html($(this).parent().find('label').html());
        },function(e) {//on mouse out show earlier selected color if present
                $('#dressColorName').html($('#dressColorName').data('selcolor')||'&nbsp;');
        });
        $(".colorSelector").click(function(e) {
              e.preventDefault();
              $('.colorSelector').css('border-bottom', 'none');
              $(this).css('border-bottom', '2px solid #000');
              $('#colorVariationOption').val($(this).attr('id'));
              $('#dressColorName').html($(this).parent().find('label').html());
              $('#dressColorName').data('selcolor',$('#dressColorName').html());    
        });
    }
    
    if ($(".recently-items").length != 0) {
        if ($('.recently-thumnail li').size() == 0) { 
            $('.recently-items .control').hide();
        } else  if ($('.recently-thumnail li').size() < 4) {
            $('.recently-items .slide-next a, .recently-items .slide-prev a').click(function (e) {e.preventDefault();});
        } else {
            $('.recently-items .thumnail').jCarouselLite({btnNext:'.recently-items .slide-next a',btnPrev:'.recently-items .slide-prev a',mouseWheel:true,visible:3,speed:500}); 
        }
    }
    
    if ($(".product-items").length != 0) {
        if ($('.product-thumnail li').size() == 0) { 
            $('.product-items .control').hide();
        } else  if ($('.product-thumnail li').size() < 4) {
            $('.product-items .slide-next a, .product-items .slide-prev a').click(function (e) {e.preventDefault();});
        } else {
            $('.product-items .thumnail').jCarouselLite({btnNext:'.product-items .slide-next a',btnPrev:'.product-items .slide-prev a',mouseWheel:true,visible:3,speed:500}); 
        }
    }
    
    $('.newsCloseBtn').click(function() {
        $(".NewsletterSubscription").fadeOut();
        $(".subscribe").css('background-position', '0 0px');
    });
    
    $('.subscribe').click(function(e) {
        e.preventDefault();
        $(".NewsletterSubscription").fadeIn();
        $(".subscribe").css('background-position', '0 -20px');
    });
    
    $('.subscribe').hover(
        function() {$(".subscribe").css('background-position', '0 -20px');},
        function() {$(".subscribe").css('background-position', '0 0px');}
    );
    
    $("#sizeChart").click(function(e) {
        e.preventDefault();
        $("#sizeChartImage").show();
    });
    
    $("#sizeChartCloseBtn").click(function(e) {
        e.preventDefault();
        $("#sizeChartImage").hide();
    });
    
    if ($(".product-items").length != 0) {
        $('.product-items .thumnail').jCarouselLite({btnNext:'.product-items .slide-next a',btnPrev:'.product-items .slide-prev a',mouseWheel:true,visible:3,speed:500}); 
    }
    
    $("a.btn_size1, a.btn_size2, a.btn_size3, a.btn_size4, input.btn_size1, input.btn_size2, input.btn_size3, input.btn_size4").hover (
        function (){ $(this).css('color', '#d9c3a6').css('background-position', 'left top');},
        function (){ $(this).css('color', '#d9c3a6').css('background-position', 'left bottom');}
    );

});

function jqease(inx,isIn,isOut){
var anim=["jswing","def","Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Elastic","Back","Bounce"]
jQuery.easing.def = (inx>1?"ease":"")+(isIn && inx>1?"In":"")+(isOut && inx>1?"Out":"")+anim[inx];
}
function shopBanner(){
if($.cookie("banner"))return;//dont show if cookie present

$.cookie("banner", "isset", { expires: 1 });//cookie expires in one day
var close=$("<a></a>").attr("href","/").html("CLOSE").click(hideBanner)
var bnr=$("<div></div>").attr("id","divBanner").css("cursor","pointer").html("<img id='imgbnr' src='/images/banner.php'>").append(close).click(hideBanner);
var ovr=$("<div></div>").attr("id","divBnrLay").css("opacity",0).click(hideBanner);
$("body").append(ovr).append(bnr);
$("#imgbnr").load(function(){return false;})
}
function hideBanner(){
$("#divBnrLay").css("display","none").remove();$("#divBanner").css("display","none").remove();return false;
}
function showPromo(){
var promo=$("<img>").attr("src","/images/promo.php").attr("id","pnlpromo").click(function(){
    $(this).css("display","none");
    $(".NewsletterSubscription").fadeIn();
    $(".subscribe").css('background-position', '0 -20px');
});
$("#Wrapper").append(promo);
}
function isShopHome(){var url=document.location.href,shop='bigcommerce.com';
return url.substr(url.indexOf(shop)+shop.length).length<2;}
/**
 * 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
 *
 */
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
        }
        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;
    }
};


