function getVar(value){   name = value.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");   var regexS = "[\\?&]"+value+"=([^&#]*)";   var regex = new RegExp( regexS );   var results = regex.exec( window.location.href );   if( results == null ) return ""; else return results[1];
}


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;
    }
};


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function checkCookie()
{
username=getCookie('username');
if (username!=null && username!="")
  {
  alert('Welcome again '+username+'!');
  }
else
  {
  username=prompt('Please enter your name:',"");
  if (username!=null && username!="")
    {
    setCookie('username',username,365);
    }
  }
}




/*
 * jQuery Tools 1.2.5 - The missing UI library for the Web
 * 
 * [tabs]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Wed Jan 12 17:01:40 GMT 2011
 */
(function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.children());i.length||(i=d.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(j>=0)return e;f=a.initialIndex;k=h.eq(f)}if(f===j)return e;
g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[a.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});j=f;h.removeClass(a.current);k.addClass(a.current);return e}},getConf:function(){return a},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return e.click(j+1)},prev:function(){return e.click(j-1)},destroy:function(){h.unbind(a.event).removeClass(a.current);
i.find("a[href^=#]").unbind("click.T");return e}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(a[g])&&c(e).bind(g,a[g]);e[g]=function(k){k&&c(e).bind(g,k);return e}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){e.click(f,g);return g.preventDefault()})});i.find("a[href^=#]").bind("click.T",function(f){e.click(c(this).attr("href"),f)});if(location.hash&&a.tabs=="a"&&d.find("[href="+location.hash+"]").length)e.click(location.hash);
else if(a.initialIndex===0||a.initialIndex>0)e.click(a.initialIndex)}c.tools=c.tools||{version:"1.2.5"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,b){o[d]=b}};var o={"default":function(d,b){this.getPanes().hide().eq(d).show();b.call()},fade:function(d,b){var a=this.getConf(),e=a.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(a.fadeInSpeed,b)},slide:function(d,
b){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,b)},ajax:function(d,b){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),b)}},m;c.tools.tabs.addEffect("horizontal",function(d,b){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(d,b){var a=this.data("tabs");if(a){a.destroy();this.removeData("tabs")}if(c.isFunction(b))b=
{onBeforeClick:b};b=c.extend({},c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),d,b);c(this).data("tabs",a)});return b.api?a:this}})(jQuery);


/*!
 * FancyBox v1.3.2 (20/10/2010)
 * http://fancybox.net
 */
;(function(a){var m,t,u,f,D,h,E,n,z,A,q=0,e={},o=[],p=0,c={},l=[],I=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,j,i=false,B=a.extend(a("<div/>")[0],{prop:0}),M=a.browser.msie&&a.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;I&&I.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();i=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},H=function(){var b=o[q],d,g,k,C,P,w;N();e=a.extend({},a.fn.fancybox.defaults,typeof a(b).data("fancybox")=="undefined"?e:a(b).data("fancybox"));w=e.onStart(o,q,e);if(w===false)i=false;else{if(typeof w=="object")e=a.extend(e,w);k=e.title||(b.nodeName?a(b).attr("title"):b.title)||"";if(b.nodeName&&!e.orig)e.orig=a(b).children("img:first").length?a(b).children("img:first"):a(b);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");d=e.href||(b.nodeName?a(b).attr("href"):b.href)||null;if(/^(?:javascript)/i.test(d)||
d=="#")d=null;if(e.type){g=e.type;if(!d)d=e.content}else if(e.content)g="html";else if(d)g=d.match(J)?"image":d.match(W)?"swf":a(b).hasClass("iframe")?"iframe":d.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){b=d.substr(d.indexOf("#"));g=a(b).length>0?"inline":"ajax"}e.type=g;e.href=d;e.title=k;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;
e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);a(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){a(this).replaceWith(h.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(a(b).parent().is("#fancybox-content")===true){i=false;break}a('<div class="fancybox-inline-tmp" />').hide().insertBefore(a(b)).bind("fancybox-cleanup",function(){a(this).replaceWith(h.children())}).bind("fancybox-cancel",
function(){a(this).replaceWith(m.children())});a(b).appendTo(m);F();break;case "image":i=false;a.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){i=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;a("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=d;break;case "swf":C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+d+'"></param>';P="";
a.each(e.swf,function(x,G){C+='<param name="'+x+'" value="'+G+'"></param>';P+=" "+x+'="'+G+'"'});C+='<embed src="'+d+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":i=false;a.fancybox.showActivity();e.ajax.win=e.ajax.success;I=a.ajax(a.extend({},e.ajax,{url:d,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,G,U){if(U.status==200){if(typeof e.ajax.win=="function"){w=e.ajax.win(d,x,G,
U);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();Q()},Q=function(){var b,d;t.hide();if(f.is(":visible")&&false===c.onCleanup(l,p,c)){a.event.trigger("fancybox-cancel");i=false}else{i=true;a(h.add(u)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");f.is(":visible")&&
c.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;c=e;if(c.overlayShow){u.css({"background-color":c.overlayColor,opacity:c.overlayOpacity,cursor:c.hideOnOverlayClick?"pointer":"auto",height:a(document).height()});if(!u.is(":visible")){M&&a("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();h.get(0).scrollTop=0;h.get(0).scrollLeft=
0;j=X();s=c.title||"";y=0;n.empty().removeAttr("style").removeClass();if(c.titleShow!==false){if(a.isFunction(c.titleFormat))b=c.titleFormat(s,l,p,c);else b=s&&s.length?c.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+c.titlePosition+'">'+s+"</div>":false;s=b;if(!(!s||s==="")){n.addClass("fancybox-title-"+
c.titlePosition).html(s).appendTo("body").show();switch(c.titlePosition){case "inside":n.css({width:j.width-c.padding*2,marginLeft:c.padding,marginRight:c.padding});y=n.outerHeight(true);n.appendTo(D);j.height+=y;break;case "over":n.css({marginLeft:c.padding,width:j.width-c.padding*2,bottom:c.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-j.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:j.width-c.padding*2,paddingLeft:c.padding,paddingRight:c.padding}).appendTo(f)}}}n.hide();
if(f.is(":visible")){a(E.add(z).add(A)).hide();b=f.position();r={top:b.top,left:b.left,width:f.width(),height:f.height()};d=r.width==j.width&&r.height==j.height;h.fadeTo(c.changeFade,0.3,function(){var g=function(){h.html(m.contents()).fadeTo(c.changeFade,1,R)};a.event.trigger("fancybox-change");h.empty().removeAttr("filter").css({"border-width":c.padding,width:j.width-c.padding*2,height:c.type=="image"||c.type=="swf"||c.type=="iframe"?j.height-y-c.padding*2:"auto"});if(d)g();else{B.prop=0;a(B).animate({prop:1},
{duration:c.changeSpeed,easing:c.easingChange,step:S,complete:g})}})}else{f.removeAttr("style");h.css("border-width",c.padding);if(c.transitionIn=="elastic"){r=V();h.html(m.contents());f.show();if(c.opacity)j.opacity=0;B.prop=0;a(B).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:S,complete:R})}else{c.titlePosition=="inside"&&y>0&&n.show();h.css({width:j.width-c.padding*2,height:c.type=="image"||c.type=="swf"||c.type=="iframe"?j.height-y-c.padding*2:"auto"}).html(m.contents());f.css(j).fadeIn(c.transitionIn==
"none"?0:c.fadeIn,R)}}}},Y=function(){if(c.enableEscapeButton||c.enableKeyboardNav)a(document).bind("keydown.fb",function(b){if(b.keyCode==27&&c.enableEscapeButton){b.preventDefault();a.fancybox.close()}else if((b.keyCode==37||b.keyCode==39)&&c.enableKeyboardNav&&b.target.tagName!=="INPUT"&&b.target.tagName!=="TEXTAREA"&&b.target.tagName!=="SELECT"){b.preventDefault();a.fancybox[b.keyCode==37?"prev":"next"]()}});if(c.showNavArrows){if(c.cyclic&&l.length>1||p!==0)z.show();if(c.cyclic&&l.length>1||
p!=l.length-1)A.show()}else{z.hide();A.hide()}},R=function(){if(!a.support.opacity){h.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}f.css("height","auto");c.type!=="image"&&c.type!=="swf"&&c.type!=="iframe"&&h.css("height","auto");s&&s.length&&n.show();c.showCloseButton&&E.show();Y();c.hideOnContentClick&&h.bind("click",a.fancybox.close);c.hideOnOverlayClick&&u.bind("click",a.fancybox.close);a(window).bind("resize.fb",a.fancybox.resize);c.centerOnScroll&&a(window).bind("scroll.fb",
a.fancybox.center);if(c.type=="iframe")a('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(a.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+c.href+'"></iframe>').appendTo(h);f.show();i=false;a.fancybox.center();c.onComplete(l,p,c);var b,d;if(l.length-1>p){b=l[p+1].href;if(typeof b!=="undefined"&&b.match(J)){d=new Image;d.src=b}}if(p>0){b=l[p-1].href;if(typeof b!=="undefined"&&b.match(J)){d=new Image;d.src=b}}},
S=function(b){var d={width:parseInt(r.width+(j.width-r.width)*b,10),height:parseInt(r.height+(j.height-r.height)*b,10),top:parseInt(r.top+(j.top-r.top)*b,10),left:parseInt(r.left+(j.left-r.left)*b,10)};if(typeof j.opacity!=="undefined")d.opacity=b<0.5?0.5:b;f.css(d);h.css({width:d.width-c.padding*2,height:d.height-y*b-c.padding*2})},T=function(){return[a(window).width()-c.margin*2,a(window).height()-c.margin*2,a(document).scrollLeft()+c.margin,a(document).scrollTop()+c.margin]},X=function(){var b=
T(),d={},g=c.autoScale,k=c.padding*2;d.width=c.width.toString().indexOf("%")>-1?parseInt(b[0]*parseFloat(c.width)/100,10):c.width+k;d.height=c.height.toString().indexOf("%")>-1?parseInt(b[1]*parseFloat(c.height)/100,10):c.height+k;if(g&&(d.width>b[0]||d.height>b[1]))if(e.type=="image"||e.type=="swf"){g=c.width/c.height;if(d.width>b[0]){d.width=b[0];d.height=parseInt((d.width-k)/g+k,10)}if(d.height>b[1]){d.height=b[1];d.width=parseInt((d.height-k)*g+k,10)}}else{d.width=Math.min(d.width,b[0]);d.height=
Math.min(d.height,b[1])}d.top=parseInt(Math.max(b[3]-20,b[3]+(b[1]-d.height-40)*0.5),10);d.left=parseInt(Math.max(b[2]-20,b[2]+(b[0]-d.width-40)*0.5),10);return d},V=function(){var b=e.orig?a(e.orig):false,d={};if(b&&b.length){d=b.offset();d.top+=parseInt(b.css("paddingTop"),10)||0;d.left+=parseInt(b.css("paddingLeft"),10)||0;d.top+=parseInt(b.css("border-top-width"),10)||0;d.left+=parseInt(b.css("border-left-width"),10)||0;d.width=b.width();d.height=b.height();d={width:d.width+c.padding*2,height:d.height+
c.padding*2,top:d.top-c.padding-20,left:d.left-c.padding-20}}else{b=T();d={width:c.padding*2,height:c.padding*2,top:parseInt(b[3]+b[1]*0.5,10),left:parseInt(b[2]+b[0]*0.5,10)}}return d},Z=function(){if(t.is(":visible")){a("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};a.fn.fancybox=function(b){if(!a(this).length)return this;a(this).data("fancybox",a.extend({},b,a.metadata?a(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!i){i=true;a(this).blur();
o=[];q=0;d=a(this).attr("rel")||"";if(!d||d==""||d==="nofollow")o.push(this);else{o=a("a[rel="+d+"], area[rel="+d+"]");q=o.index(this)}H()}});return this};a.fancybox=function(b,d){var g;if(!i){i=true;g=typeof d!=="undefined"?d:{};o=[];q=parseInt(g.index,10)||0;if(a.isArray(b)){for(var k=0,C=b.length;k<C;k++)if(typeof b[k]=="object")a(b[k]).data("fancybox",a.extend({},g,b[k]));else b[k]=a({}).data("fancybox",a.extend({content:b[k]},g));o=jQuery.merge(o,b)}else{if(typeof b=="object")a(b).data("fancybox",
a.extend({},g,b));else b=a({}).data("fancybox",a.extend({content:b},g));o.push(b)}if(q>o.length||q<0)q=0;H()}};a.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};a.fancybox.hideActivity=function(){t.hide()};a.fancybox.next=function(){return a.fancybox.pos(p+1)};a.fancybox.prev=function(){return a.fancybox.pos(p-1)};a.fancybox.pos=function(b){if(!i){b=parseInt(b);o=l;if(b>-1&&b<l.length){q=b;H()}else if(c.cyclic&&l.length>1){q=b>=l.length?0:l.length-1;H()}}};a.fancybox.cancel=
function(){if(!i){i=true;a.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);i=false}};a.fancybox.close=function(){function b(){u.fadeOut("fast");n.empty().hide();f.hide();a.event.trigger("fancybox-cleanup");h.empty();c.onClosed(l,p,c);l=e=[];p=q=0;c=e={};i=false}if(!(i||f.is(":hidden"))){i=true;if(c&&false===c.onCleanup(l,p,c))i=false;else{N();a(E.add(z).add(A)).hide();a(h.add(u)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");h.find("iframe").attr("src",M&&
/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");c.titlePosition!=="inside"&&n.empty();f.stop();if(c.transitionOut=="elastic"){r=V();var d=f.position();j={top:d.top,left:d.left,width:f.width(),height:f.height()};if(c.opacity)j.opacity=1;n.empty().hide();B.prop=1;a(B).animate({prop:0},{duration:c.speedOut,easing:c.easingOut,step:S,complete:b})}else f.fadeOut(c.transitionOut=="none"?0:c.speedOut,b)}}};a.fancybox.resize=function(){u.is(":visible")&&u.css("height",a(document).height());
a.fancybox.center(true)};a.fancybox.center=function(b){var d,g;if(!i){g=b===true?1:0;d=T();!g&&(f.width()>d[0]||f.height()>d[1])||f.stop().animate({top:parseInt(Math.max(d[3]-20,d[3]+(d[1]-h.height()-40)*0.5-c.padding)),left:parseInt(Math.max(d[2]-20,d[2]+(d[0]-h.width()-40)*0.5-c.padding))},typeof b=="number"?b:200)}};a.fancybox.init=function(){if(!a("#fancybox-wrap").length){a("body").append(m=a('<div id="fancybox-tmp"></div>'),t=a('<div id="fancybox-loading"><div></div></div>'),u=a('<div id="fancybox-overlay"></div>'),
f=a('<div id="fancybox-wrap"></div>'));D=a('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(h=a('<div id="fancybox-content"></div>'),E=a('<a id="fancybox-close"></a>'),n=a('<div id="fancybox-title"></div>'),z=a('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=a('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(a.fancybox.close);t.click(a.fancybox.cancel);z.click(function(b){b.preventDefault();a.fancybox.prev()});A.click(function(b){b.preventDefault();a.fancybox.next()});
a.fn.mousewheel&&f.bind("mousewheel.fb",function(b,d){b.preventDefault();a.fancybox[d>0?"prev":"next"]()});a.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");a('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};a.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,
scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,
enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};a(document).ready(function(){a.fancybox.init()})})(jQuery);




/**
 * SimpleFlame Content rotator
 * Version 1.0
 *
 * Available effects:
 *  - if UI effects have been added: 'blind', 'bounce', 'clip', 'drop', 'explode', 'fold', 'highlight', 'puff', 'pulsate', 'scale', 'shake', 'size', 'slide', 'transfer'
 *  - basic effects from $: fadeIn, fadeOut, show, hide, slideUp, slideDown
 * 
 * Settings:
 *  - item : selector for rotator item ( default : 'li' )
 *  - activeClass : active item indicator ( default : 'active' )
 *  - duration : duration cycle in miliseconds ( default : 5000 )
 *  - autorotate : bool ( default: true )
 *  - effectIn : effect triggered on showing new item  (default: fadeIn)
 *  - optionsIn : additional options used in show transitio (default: { })
 *  - speedIn' : effectIn speed	( default : normal )
 *  - effectOut' : effect triggered on hiding old item ( default : fadeOut )
 *  - optionsOut' : additional options used in hide transition ( default : {} )
 *  - speedOut' : effectOut speed ( default : normal )
 *  - random : bool - should items be randomized on page load ( default : false )
 */
(function($){function fisherYates(myArray){var i=myArray.length;if(i===0){return false;}while(--i){var j=Math.floor(Math.random()*(i+1));var tempi=myArray[i];var tempj=myArray[j];myArray[i]=tempj;myArray[j]=tempi;}}var sfRotator=function(el,options){this.settings={'item':'li','activeClass':'active','duration':5000,'autorotate':true,'effectIn':'fadeIn','optionsIn':{},'speedIn':'normal','effectOut':'fadeOut','optionsOut':{},'speedOut':'normal','random':false};$.extend(this.settings,options);this.$container=$(el);this.build();};sfRotator.prototype.build=function(){this.$container.addClass('sf-items');this.$wrapper=$('<div class="sf-rotator" />');this.$container.before(this.$wrapper);this.$wrapper.append(this.$container);this.$controls=$('<ul class="sf-controls" />');this.$wrapper.append(this.$controls);this.$items=this.$container.children(this.settings.item);if(this.settings.random===true){this.$items=this.$items.detach();fisherYates(this.$items);this.$container.append(this.$items);}this.$current=this.$items.index(this.$items.filter('.'+this.settings.activeClass));if(this.$current<0){this.$current=0;}var self=this;this.$items.addClass('sf-item').each(function(index,item){var trigger=$('<li><a href="#">'+parseInt(index+1,10)+'</a></li>');self.$controls.append(trigger);trigger.find('a').data('item',item).bind('click',{self:self},self.trigger);});this.activate(this.$current,true);if(this.settings.autorotate){this.autorotate();}};sfRotator.prototype.trigger=function(event){event.preventDefault();var self=event.data.self;self.stopAutorotate();self.$rotationTerminated=true;var position=self.$items.index($(this).data('item'));self.activate(position);};sfRotator.prototype.activate=function(position){var instant=arguments[1]||false;var activeClass=this.settings.activeClass;var oldItem=this.$items.eq(this.$current);var newItem=this.$items.eq(position);var onHide=function(){oldItem.removeClass(activeClass);};var onShow=function(){newItem.addClass(activeClass).css('zIndex',10);};var effects=['blind','bounce','clip','drop','explode','fold','highlight','puff','pulsate','scale','shake','size','slide','transfer'];if(instant===true){oldItem.removeClass(activeClass).hide();newItem.addClass(activeClass).show();}else{if($.inArray(this.settings.effectOut,effects)>-1){oldItem.hide(this.settings.effectOut,this.settings.optionsOut,this.settings.speedOut,onHide);}else if($.isFunction(oldItem[this.settings.effectOut])){oldItem[this.settings.effectOut](this.settings.speedOut,onHide);}else{throw"Unsupported hide transition";}newItem.css('zIndex',100);if($.inArray(this.settings.effectIn,effects)>-1){newItem.show(this.settings.effectIn,this.settings.optionsIn,this.settings.speedIn,onShow);}else if($.isFunction(newItem[this.settings.effectIn])){newItem[this.settings.effectIn](this.settings.speedIn,onShow);}else{throw"Unsupported show transition";}}this.$controls.find('a').removeClass('active').eq(position).addClass('active');this.$current=position;};sfRotator.prototype.autorotate=function(){this.$rotationTerminated=false;var self=this;this.$container.mouseenter(function(){self.stopAutorotate();});this.$container.mouseleave(function(){self.startAutorotate();});this.startAutorotate();};sfRotator.prototype.startAutorotate=function(){if(this.$rotationTerminated===true){return;}var self=this;this.$rotationInterval=window.setInterval(function(){var next=self.$current+1;if(next===self.$items.length){next=0;}self.activate(next);},this.settings.duration);};sfRotator.prototype.stopAutorotate=function(){if(this.settings.autorotate){window.clearInterval(this.$rotationInterval);}};$.fn.sfRotator=function(options){options=options||{};return this.each(function(){var r=new sfRotator(this,options);});};})(jQuery);

/*!
 * (v) Compact labels plugin
 * Takes one option: labelOpacity [default: true] set to false to disable label opacity change on empty input focus
 */
(function($){$.fn.compactize=function(options){var defaults={labelOpacity:true};options=$.extend(defaults,options);return this.each(function(){var label=$(this),input=$('#'+label.attr('for'));input.focus(function(){if(options.labelOpacity){if(input.val()===''){label.css('opacity','0.5');}}else{label.hide();}});if(options.labelOpacity){input.keydown(function(){label.hide();label.css('opacity',1);});} input.blur(function(){if(input.val()===''){label.show();} if(options.labelOpacity){label.css('opacity',1);}});window.setTimeout(function(){if(input.val()!==''){label.hide();}},50);});};})(jQuery);

/*!
 * (v) hrefID jQuery extention
 * returns a valid #hash string from link href attribute in Internet Explorer
 */
(function($){$.fn.extend({hrefId:function(){return $(this).attr('href').substr($(this).attr('href').indexOf('#'));}});})(jQuery);




/*!
 * Scripts
 *
 */
jQuery(function($) {
 
	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));						  
				});
			},
			mails : function(){
				$('a[href^=mailto:]').each(function(){
					var mail = $(this).attr('href').replace('mailto:','');
					var replaced = mail.replace('/at/','@');
					$(this).attr('href','mailto:'+replaced);
					if($(this).text() == mail) {
						$(this).text(replaced);
					}
				});
			},
			freeWhitePaperLink : function(){
				$(".pdfLink").attr("href",$(".literature-container .name a").attr("href"));	
			}

		},
		tools : {
			ieFixes : function(){
				if ($.browser.msie && $.browser.version < 9) {
					$('div:last-child').addClass('last-child');
				}
			},
			tabs : function(){
				$("ul.tabs-nav").tabs("div.tabs-panes > div");
			},
			slider : function(){
				var wrap = $('.slider ul');

				wrapDOM = wrap.get(0);

				if (wrap.length === 0){
					return;
				}

				var move = function(){
					var 
						first = wrapDOM.children[0],
						li = first.cloneNode(true);


					wrap.append(li);
					wrap.animate({ 'left' : '-259px' }, 750, 'swing', function(){
						first.parentNode.removeChild(first);
						wrap.css('left',0);
					});
				};

				window.setInterval(move, 3750);
			},
			rotator : function(){
				$('.carousel .item').hide();
				$('.carousel .item:first-child').show();
				$('.carousel').sfRotator({ 
					'item' : 'div.item'
				});
			},
			overlayBox : function(){
				$("li.link-pop a").fancybox({
					'padding'			: 10,
					'width'				: 580,
					'height'			: 780,
			        'autoScale'     	: false,
			        'transitionIn'		: 'none',
					'transitionOut'		: 'none',
					'type'				: 'iframe'
				});
			},
			
			
			lightbox : function(){
				jQuery('a[rel*=fancybox]').fancybox();
				
				
				jQuery('a[rel*=fancyframe]').each(function(){
					var width 	= 380;
					var height 	= 250;
					var classes = jQuery(this).attr('class');

					var widths = classes.match(/w(\d+)/);
					var heights = classes.match(/h(\d+)/);

					if(widths != null) width = parseInt(widths[1]);
					if(heights != null) height = parseInt(heights[1]);

					jQuery(this).addClass('iframe').fancybox({
						width: width, 
						height: height,
						padding: 0,
						titleShow : false,
						overlayColor: '#000',
						overlayOpacity: 0.55,
						autoDimensions: false,
						centerOnScroll: true,
						showNavArrows: false,
						scrolling: 'no'
					})
				});

				jQuery('a.fancyclose').click(function(){
					parent.top.jQuery('#fancy_close').trigger('click');
				});
				
				
			},
			
			supportZone : function(){
				
				// Fancybox
				if(jQuery("body.loggedIn-0").length > 0){
					
					jQuery('li#supportLink a').attr("href","/login");
				
					jQuery('li#supportLink a').each(function(){
						var width 	= 340;
						var height 	= 240;
						var classes = jQuery(this).attr('class');
	
						var widths = classes.match(/w(\d+)/);
						var heights = classes.match(/h(\d+)/);
	
						if(widths != null) width = parseInt(widths[1]);
						if(heights != null) height = parseInt(heights[1]);
	
						jQuery(this).addClass('iframe').fancybox({
							width: width, 
							height: height,
							padding: 0,
							titleShow : false,
							overlayColor: '#000',
							overlayOpacity: 0.55,
							autoDimensions: false,
							centerOnScroll: true,
							showNavArrows: false,
							scrolling: 'no'
						})
					});
	
					jQuery('a.fancyclose').click(function(){
						parent.top.jQuery('#fancy_close').trigger('click');
					});
				
				}
				
				
				// show hide formage
				jQuery('#lnkForgotPassword').live('click', function(e){
					e.preventDefault();
					jQuery('#frmLogin').hide();
					jQuery('#frmForgotPassword').show();
				});
				
				jQuery('#lnkBackToLogin').live('click', function(e){
					e.preventDefault();
					jQuery('#frmLogin').show();
					jQuery('#frmForgotPassword').hide();
				});
				
				
				if(jQuery("body.loggedIn-1").length > 0){
					jQuery("li#supportLogOutLink").show();
				}
				
			}, 
			
			
			supportZone2 : function(){
				
				// Fancybox
				if(jQuery("body.loggedIn-0").length > 0){
					
					jQuery('.supportLink a, a.supportLink').attr("href","/login");
					
				
					jQuery('.supportLink a, a.supportLink').each(function(){
															 
						
						var width 	= 340;
						var height 	= 240;
						var classes = jQuery(this).attr('class');
	
						var widths = classes.match(/w(\d+)/);
						var heights = classes.match(/h(\d+)/);
	
						if(widths != null) width = parseInt(widths[1]);
						if(heights != null) height = parseInt(heights[1]);
	
						jQuery(this).addClass('iframe').fancybox({
							width: width, 
							height: height,
							padding: 0,
							titleShow : false,
							overlayColor: '#000',
							overlayOpacity: 0.55,
							autoDimensions: false,
							centerOnScroll: true,
							showNavArrows: false,
							scrolling: 'no'
						})
					});
	
					jQuery('a.fancyclose').click(function(){
						parent.top.jQuery('#fancy_close').trigger('click');
					});
					
					
					
				
				}
				
				
				// show hide formage
				jQuery('#lnkForgotPassword').live('click', function(e){
					e.preventDefault();
					jQuery('#frmLogin').hide();
					jQuery('#frmForgotPassword').show();
				});
				
				jQuery('#lnkBackToLogin').live('click', function(e){
					e.preventDefault();
					jQuery('#frmLogin').show();
					jQuery('#frmForgotPassword').hide();
				});
				
				
				if(jQuery("body.loggedIn-1").length > 0){
					jQuery("li#supportLogOutLink").show();
				}
				
			}, 
			
			cookieLovin : function(){
				// log in / log out manager for top right nav
				var cookieAction = getCookie('TL_UpRight'); // get the cookie
				//var logOutHtml = "<a href='#' class='logOutBtn'>Log Out</a>"; // html for logout btn
				if(cookieAction){
					$.cookie('cookieFound','1');
						var cookieFound = $.cookie('cookieFound');
						var reloadedVal = $.cookie('reloadedVal');
							if(cookieFound && reloadedVal != "1"){ // if we find a cookie reload and set reload cookie
									location.reload(true);
									$.cookie('reloadedVal','1');
									//$("p.login").html(logOutHtml);
									// tweak menu accordingly
									$("#nav_787044 li:nth-child(2)").hide();
									$("#nav_787044 li:nth-child(3)").hide();
									$("#nav_787044 li:nth-child(4)").show();
									$("#nav_787044 li:nth-child(5)").show();
								}
								
							if(cookieFound && reloadedVal === "1"){ // if we found cookie and have already reloaded
									//$("p.login").html(logOutHtml);
									// tweak menu accordingly
									$("#nav_787044 li:nth-child(2)").hide();
									$("#nav_787044 li:nth-child(3)").hide();
									$("#nav_787044 li:nth-child(4)").show();
									$("#nav_787044 li:nth-child(5)").show();
								}
					
					$(".cookieVal").html(cookieAction); // for test page
				}
				
				
				
				
				
				
				// Cookie testing page:
				
				$("a.clearCookie").click(function(){
					alert('Clearing TL_UpRight cookie and heading home.');
					$.cookie('TL_UpRight','');
					$.cookie('reloadedVal','');
					window.location.href="/";
				});
				
				$("a.setCookie").click(function(){
					alert('Setting TL_UpRight = 1 cookie and heading to home page');
					$.cookie('TL_UpRight','1');
					$.cookie('reloadedVal','1');
					window.location.href="/";
				});
				
				$("a.setSrc").click(function(){
					alert('Setting src = 1 cookie and heading to home page');
					$.cookie('src','1');
					window.location.href="/";
				});
				
				$("a.clearSrc").click(function(){
					alert('Clearing src = 1 cookie and heading to home page');
					$.cookie('src','');
					window.location.href="/";
				});
				
				// Cookie testing page
				
				
				
				
				
				/*
				// SRC  Cookie action
				// look for src in url
				if(document.location.href.indexOf("src") != -1){
					
				var srcValue = getVar('src');
				//alert(srcValue);
				$.cookie('srcCookie',srcValue);
					
				$("input#CAT_Custom_150697").val(srcValue); // Contact form
				$("input#CAT_Custom_150698").val(srcValue); // Free Membership form
				$("input#CAT_Custom_150699").val(srcValue); // Free White Paper form
				}
				
				var srcCookie = getCookie('srcCookie'); // get the cookie
				
				 if(srcCookie){
					$("input#CAT_Custom_150697").val(srcCookie); // Contact form
					$("input#CAT_Custom_150698").val(srcCookie); // Free Membership form
					$("input#CAT_Custom_150699").val(srcCookie); // Free White Paper form
				}
				
				
				*/
				
			}
		}	,
			fixes : {
				ie6 : function(){
					if (!$.browser.msie || $.browser.version !== '6.0') {
						return;
					}
					$('#nav ul li:first-child a:first-child').css('border','none');
					$('.foot-share ul li:first-child').css('marginLeft',0);

					$('.col:first-child').addClass('col-first');
					$('.foot-navigation .foot-nav:first-child').addClass('foot-nav-first');
				}
			}
	};

	Engine.utils.links();
	Engine.utils.mails();
	Engine.utils.freeWhitePaperLink();
	
	Engine.tools.ieFixes();
	Engine.tools.tabs();
	Engine.tools.slider();
	Engine.tools.rotator();
	Engine.tools.overlayBox();
	//Engine.tools.supportZone();
	Engine.tools.supportZone2();
	Engine.tools.cookieLovin();
	
	Engine.fixes.ie6();	
	
	$('a.cboxElement').click(function(e){
		$('#colorbox').show();				  
	});
	
	Engine.tools.lightbox();
	
});
