/* setting up the session variables for contact us page*/
function processCallToAction(title, url){

    window.frames['setupSession'].document.getElementById("pageTitle").value = title;
    window.frames['setupSession'].document.getElementById("submissionForm").submit(); 
    setTimeout(function() { document.location = url; }, 600); 
}

/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
*
* Example usage:
* DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
* DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
**/
if ($.browser.msie && $.browser.version < 7) {
var DD_belatedPNG={ns:"DD_belatedPNG",imgSize:{},delay:10,nodesFixed:0,createVmlNameSpace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createVmlStyleSheet:function(){var b,a;b=document.createElement("style");b.setAttribute("media","screen");document.documentElement.firstChild.insertBefore(b,document.documentElement.firstChild.firstChild);if(b.styleSheet){b=b.styleSheet;b.addRule(this.ns+"\\:*","{behavior:url(#default#VML)}");b.addRule(this.ns+"\\:shape","position:absolute;");b.addRule("img."+this.ns+"_sizeFinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;");this.screenStyleSheet=b;a=document.createElement("style");a.setAttribute("media","print");document.documentElement.firstChild.insertBefore(a,document.documentElement.firstChild.firstChild);a=a.styleSheet;a.addRule(this.ns+"\\:*","{display: none !important;}");a.addRule("img."+this.ns+"_sizeFinder","{display: none !important;}")}},readPropertyChange:function(){var b,c,a;b=event.srcElement;if(!b.vmlInitiated){return}if(event.propertyName.search("background")!=-1||event.propertyName.search("border")!=-1){DD_belatedPNG.applyVML(b)}if(event.propertyName=="style.display"){c=(b.currentStyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasOwnProperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyName.search("filter")!=-1){DD_belatedPNG.vmlOpacity(b)}},vmlOpacity:function(b){if(b.currentStyle.filter.search("lpha")!=-1){var a=b.currentStyle.filter;a=parseInt(a.substring(a.lastIndexOf("=")+1,a.lastIndexOf(")")),10)/100;b.vml.color.shape.style.filter=b.currentStyle.filter;b.vml.image.fill.opacity=a}},handlePseudoHover:function(a){setTimeout(function(){DD_belatedPNG.applyVML(a)},1)},fix:function(a){if(this.screenStyleSheet){var c,b;c=a.split(",");for(b=0;b<c.length;b++){this.screenStyleSheet.addRule(c[b],"behavior:expression(DD_belatedPNG.fixPng(this))")}}},applyVML:function(a){a.runtimeStyle.cssText="";this.vmlFill(a);this.vmlOffsets(a);this.vmlOpacity(a);if(a.isImg){this.copyImageBorders(a)}},attachHandlers:function(i){var d,c,g,e,b,f;d=this;c={resize:"vmlOffsets",move:"vmlOffsets"};if(i.nodeName=="A"){e={mouseleave:"handlePseudoHover",mouseenter:"handlePseudoHover",focus:"handlePseudoHover",blur:"handlePseudoHover"};for(b in e){if(e.hasOwnProperty(b)){c[b]=e[b]}}}for(f in c){if(c.hasOwnProperty(f)){g=function(){d[c[f]](i)};i.attachEvent("on"+f,g)}}i.attachEvent("onpropertychange",this.readPropertyChange)},giveLayout:function(a){a.style.zoom=1;if(a.currentStyle.position=="static"){a.style.position="relative"}},copyImageBorders:function(b){var c,a;c={borderStyle:true,borderWidth:true,borderColor:true};for(a in c){if(c.hasOwnProperty(a)){b.vml.color.shape.style[a]=b.currentStyle[a]}}},vmlFill:function(e){if(!e.currentStyle){return}else{var d,f,g,b,a,c;d=e.currentStyle}for(b in e.vml){if(e.vml.hasOwnProperty(b)){e.vml[b].shape.style.zIndex=d.zIndex}}e.runtimeStyle.backgroundColor="";e.runtimeStyle.backgroundImage="";f=true;if(d.backgroundImage!="none"||e.isImg){if(!e.isImg){e.vmlBg=d.backgroundImage;e.vmlBg=e.vmlBg.substr(5,e.vmlBg.lastIndexOf('")')-5)}else{e.vmlBg=e.src}g=this;if(!g.imgSize[e.vmlBg]){a=document.createElement("img");g.imgSize[e.vmlBg]=a;a.className=g.ns+"_sizeFinder";a.runtimeStyle.cssText="behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;";c=function(){this.width=this.offsetWidth;this.height=this.offsetHeight;g.vmlOffsets(e)};a.attachEvent("onload",c);a.src=e.vmlBg;a.removeAttribute("width");a.removeAttribute("height");document.body.insertBefore(a,document.body.firstChild)}e.vml.image.fill.src=e.vmlBg;f=false}e.vml.image.fill.on=!f;e.vml.image.fill.color="none";e.vml.color.shape.style.backgroundColor=d.backgroundColor;e.runtimeStyle.backgroundImage="none";e.runtimeStyle.backgroundColor="transparent"},vmlOffsets:function(d){var h,n,a,e,g,m,f,l,j,i,k;h=d.currentStyle;n={W:d.clientWidth+1,H:d.clientHeight+1,w:this.imgSize[d.vmlBg].width,h:this.imgSize[d.vmlBg].height,L:d.offsetLeft,T:d.offsetTop,bLW:d.clientLeft,bTW:d.clientTop};a=(n.L+n.bLW==1)?1:0;e=function(b,p,q,c,s,u){b.coordsize=c+","+s;b.coordorigin=u+","+u;b.path="m0,0l"+c+",0l"+c+","+s+"l0,"+s+" xe";b.style.width=c+"px";b.style.height=s+"px";b.style.left=p+"px";b.style.top=q+"px"};e(d.vml.color.shape,(n.L+(d.isImg?0:n.bLW)),(n.T+(d.isImg?0:n.bTW)),(n.W-1),(n.H-1),0);e(d.vml.image.shape,(n.L+n.bLW),(n.T+n.bTW),(n.W),(n.H),1);g={X:0,Y:0};if(d.isImg){g.X=parseInt(h.paddingLeft,10)+1;g.Y=parseInt(h.paddingTop,10)+1}else{for(j in g){if(g.hasOwnProperty(j)){this.figurePercentage(g,n,j,h["backgroundPosition"+j])}}}d.vml.image.fill.position=(g.X/n.W)+","+(g.Y/n.H);m=h.backgroundRepeat;f={T:1,R:n.W+a,B:n.H,L:1+a};l={X:{b1:"L",b2:"R",d:"W"},Y:{b1:"T",b2:"B",d:"H"}};if(m!="repeat"||d.isImg){i={T:(g.Y),R:(g.X+n.w),B:(g.Y+n.h),L:(g.X)};if(m.search("repeat-")!=-1){k=m.split("repeat-")[1].toUpperCase();i[l[k].b1]=1;i[l[k].b2]=n[l[k].d]}if(i.B>n.H){i.B=n.H}d.vml.image.shape.style.clip="rect("+i.T+"px "+(i.R+a)+"px "+i.B+"px "+(i.L+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.T+"px "+f.R+"px "+f.B+"px "+f.L+"px)"}},figurePercentage:function(d,c,f,a){var b,e;e=true;b=(f=="X");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseInt(a,10)/100}else{e=false}}d[f]=Math.ceil(e?((c[b?"W":"H"]*d[f])-(c[b?"w":"h"]*d[f])):parseInt(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixPng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodeName=="BODY"||c.nodeName=="TD"||c.nodeName=="TR"){return}c.isImg=false;if(c.nodeName=="IMG"){if(c.src.toLowerCase().search(/\.png$/)!=-1){c.isImg=true;c.style.visibility="hidden"}else{return}}else{if(c.currentStyle.backgroundImage.toLowerCase().search(".png")==-1){return}}g=DD_belatedPNG;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasOwnProperty(a)){for(d in b){if(b.hasOwnProperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createElement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendChild(c.vml[a].fill);c.parentNode.insertBefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachHandlers(c);g.giveLayout(c);g.giveLayout(c.offsetParent);c.vmlInitiated=true;g.applyVML(c)}};try{document.execCommand("BackgroundImageCache",false,true)}catch(r){}DD_belatedPNG.createVmlNameSpace();DD_belatedPNG.createVmlStyleSheet();
}


/*pageTitle end*/

/* fixing ie glitch in jquery's fadeIn/fadeOut */
(function($) {
    $.fn.newFadeIn = function(speed, callback) {
        $(this).fadeIn(speed, function() {
            if(jQuery.browser.msie)
                $(this).get(0).style.removeAttribute('filter');
            if(callback != undefined)
                callback();
        });
    };
    $.fn.newFadeOut = function(speed, callback) {
        $(this).fadeOut(speed, function() {
            if(jQuery.browser.msie)
                $(this).get(0).style.removeAttribute('filter');
            if(callback != undefined)
                callback();
        });
    };
})(jQuery);



/* fix console.log messages in IE */
if(window['console'] === undefined)
   window.console = { log: function(){} 
}; 


/* replaceClass */
jQuery.fn.extend({
        'replaceClass': function(remC,addC){
            return this.each(function() {
$(this).removeClass(remC).addClass(addC);
});
        }
}); 

/* BigTarget */
(function($){$.fn.bigTarget=function(options){debug(this);var opts=$.extend({},$.fn.bigTarget.defaults,options);return this.each(function(){var $a=$(this);var href=$a.attr('href');var title=$a.attr('title');var o=$.meta?$.extend({},opts,$a.data()):opts;$a.parents(o.clickZone).hover(function(){var $h=$(this);$h.addClass(o.hoverClass);if(typeof o.title!='undefined'&&o.title===true&&title!=''){$h.attr('title',title);}},function(){var $h=$(this);$h.removeClass(o.hoverClass);if(typeof o.title!='undefined'&&o.title===true&&title!=''){$h.removeAttr('title');}}).click(function(){if(getSelectedText()=="")
{if($a.is('[rel*=external]')){window.open(href);return false;}
else{window.location=href;}}});});};function debug($obj){if(window.console&&window.console.log)
window.console.log('bigTarget selection count: '+$obj.size());};function getSelectedText(){if(window.getSelection){return window.getSelection().toString();}
else if(document.getSelection){return document.getSelection();}
else if(document.selection){return document.selection.createRange().text;}};$.fn.bigTarget.defaults={hoverClass:'hover',clickZone:'li:eq(0)',title:true};})(jQuery);

/* jcarousel lite 1.0.1 */
/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/

 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.0.1
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */

/**
 * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
 *
 * The HTML markup that is used to build the carousel can be as simple as...
 *
 *  <div class="carousel">
 *      <ul>
 *          <li><img src="image/1.jpg" alt="1"></li>
 *          <li><img src="image/2.jpg" alt="2"></li>
 *          <li><img src="image/3.jpg" alt="3"></li>
 *      </ul>
 *  </div>
 *
 * As you can see, this snippet is nothing but a simple div containing an unordered list of images.
 * You don't need any special "class" attribute, or a special "css" file for this plugin.
 * I am using a class attribute just for the sake of explanation here.
 *
 * To navigate the elements of the carousel, you need some kind of navigation buttons.
 * For example, you will need a "previous" button to go backward, and a "next" button to go forward.
 * This need not be part of the carousel "div" itself. It can be any element in your page.
 * Lets assume that the following elements in your document can be used as next, and prev buttons...
 *
 * <button class="prev">&lt;&lt;</button>
 * <button class="next">&gt;&gt;</button>
 *
 * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
 * navigation buttons as options.
 *
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 *
 * That's it, you would have now converted your raw div, into a magnificient carousel.
 *
 * There are quite a few other options that you can use to customize it though.
 * Each will be explained with an example below.
 *
 * @param an options object - You can specify all the options shown below as an options object param.
 *
 * @option btnPrev, btnNext : string - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
 *
 * @option btnGo - array - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      btnGo: [".0", ".1", ".2"]
 * });
 * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
 * the item number within the carousel, you can use this option. Just supply an array of selectors for each element
 * in the carousel. The index of the array represents the index of the element. What i mean is, if the
 * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
 * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
 * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
 * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
 * The best part is that, the tab will "slide" based on the provided effect. :-)
 *
 * @option mouseWheel : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      mouseWheel: true
 * });
 * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
 * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
 * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
 * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
 * as well. They complement each other. To use both together, just supply the options required for both as shown below.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      mouseWheel: true
 * });
 *
 * @option auto : number - default is null, meaning autoscroll is disabled by default
 * @example
 * $(".carousel").jCarouselLite({
 *      auto: 800,
 *      speed: 500
 * });
 * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
 * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
 * Specify this value and magically your carousel will start auto scrolling.
 *
 * @option speed : number - 200 is default
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      speed: 800
 * });
 * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
 * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
 *
 * @option easing : string - no easing effects by default.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      easing: "bounceout"
 * });
 * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
 * the carousel will slide based on the provided easing effect.
 *
 * @option vertical : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      vertical: true
 * });
 * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
 * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
 * display horizontally. The next and prev items will slide the items from left-right in this case.
 *
 * @option circular : boolean - default is true
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      circular: false
 * });
 * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
 * element, you will automatically slide to the first element and vice versa. If you set circular to false, then
 * if you click on the "next" button after you reach the last element, you will stay in the last element itself
 * and similarly for "previous" button and first element.
 *
 * @option visible : number - default is 3
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      visible: 4
 * });
 * @desc This specifies the number of items visible at all times within the carousel. The default is 3.
 * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
 * last item half visible. This gives you the effect of showing the user that there are more images to the right.
 *
 * @option start : number - default is 0
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      start: 2
 * });
 * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
 * has a start of 0, and so on.
 *
 * @option scrool : number - default is 1
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      scroll: 2
 * });
 * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
 * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
 * 2 items when you click the next or previous buttons.
 *
 * @option beforeStart, afterEnd : function - callbacks
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      beforeStart: function(a) {
 *          alert("Before animation starts:" + a);
 *      },
 *      afterEnd: function(a) {
 *          alert("After animation ends:" + a);
 *      }
 * });
 * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
 * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
 * are visible at the time of callback.
 *
 *
 * @cat Plugins/Image Gallery
 * @author Ganeshji Marwaha/ganeshread@gmail.com
 */
;(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var running=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$("ul",div),tLi=$("li",ul),tl=tLi.length,v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v;}
var li=$("li",ul),itemLength=li.length,curr=o.start;div.css("visibility","visible");li.css({overflow:"hidden",'float':o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});div.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var liSize=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;li.css({width:li.width(),height:li.height()});ul.css(sizeCss,ulSize+"px").css(animCss,-(curr*liSize));div.css(sizeCss,divSize+"px");if(tl==1){$(o.btnPrev+','+o.btnNext).addClass('disabled');return false;}
if(o.btnPrev){$(o.btnPrev).click(function(){return go(curr-o.scroll);});}
if(o.btnNext){$(o.btnNext).click(function(){return go(curr+o.scroll);});}
if(o.btnGo)
$.each(o.btnGo,function(i,val){$(val).click(function(){return go(o.circular?o.visible+i:i);});});if(o.mouseWheel&&div.mousewheel)
div.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll);});if(o.auto)
setInterval(function(){go(curr+o.scroll);},o.auto+o.speed);function vis(){return li.slice(curr).slice(0,v);};function go(to){if(!running){if(o.beforeStart)
o.beforeStart.call(this,vis());if(o.circular){if(to<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*liSize)+"px");curr=to==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll;}else if(to>=itemLength-v+1){ul.css(animCss,-((v)*liSize)+"px");curr=to==itemLength-v+1?v+1:v+o.scroll;}else curr=to;}else{if(to<0||to>itemLength-v)return;else curr=to;}
running=true;ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},o.speed,o.easing,function(){if(o.afterEnd){o.afterEnd.call(this,vis());}
running=false;});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled");console.log($('.prev1').get(0).className)}}
return false;};});};function css(el,prop){return parseInt($.css(el[0],prop))||0;};function width(el){return el[0].offsetWidth+css(el,'marginLeft')+css(el,'marginRight');};function height(el){return el[0].offsetHeight+css(el,'marginTop')+css(el,'marginBottom');};})(jQuery);


/* from flash de-con */

var VERSION = "2.10";
var DEFAULT_ISO  = "en-gb";
var DEFAULT_MODE = "full";
var MIN_FLASH = "9.0.115";

var URLParams = getURLParams();

function getURLParams()
{
var o = {};
if( !document.location.search.length ) return o;

var params = document.location.search.substr( 1 ).split( "&" );
var parts;
for( var i in params ){
parts = params[i].split( "=" );
o[ parts[0] ] = parts[1];
}
return o;
}

function getParam( name,defaultvalue )
{
return URLParams[ name ] || defaultvalue;
}

function createFlash( flashPath,containerID,width,height )
{
flashPath += flashPath.indexOf( "?" ) == -1 ? "?v=" : "&v=";
flashPath += VERSION;

var vars = {
iso:  getParam( "iso",DEFAULT_ISO ).replace( "_","-" ).toLowerCase(),
mode: getParam( "mode",DEFAULT_MODE ).toLowerCase(),
trackid: getParam( "trackid",undefined ),
clear: getParam( "clear",undefined ),
version:  VERSION,
url: escape( document.location.toString() )
};

// Look for pre-defined flashvars //
if( window.flashvars ){
for( var i in window.flashvars ) vars[i] = window.flashvars[i];
}

window.flashvars = vars;


var params = {
bgcolor:  "#FFFFFF",
allowfullscreen:  "true",
allowscriptaccess:  "always",
menu:  "false",
wmode: "window"
};


// Look for pre-defined flashparams //
if( window.flashparams )
{
for( var i in window.flashparams ) 
{
params[i] = window.flashparams[i];
}
}
window.flashparams = params;

var attributes = { 
//id: "content"
};

//alert( flashvars.mode );

swfobject.embedSWF( 
flashPath,
containerID,
width,height,
MIN_FLASH,
"./swf/expressinstall.swf",
flashvars,params,attributes 
);
}

function track(type,name,path)
{
// Types: view,element,event //

switch( new String( type ).toLowerCase() ){
case "view":
window.parent.cmCreatePageviewTag( name,path );
return;

case "element":
window.parent.cmCreatePageElementTag( name,path );
return;

case "event":
window.parent.cmCreateConversionEventTag( name,"2",path,"50" );
return;
}

//alert( "tracking: " + path );
}

// Stubs //
function dummy( a,b,c,d ){ console.info( a + "," + b + "," + c + "," + d ); }
if( !window.parent.cmCreatePageviewTag ) window.parent.cmCreatePageviewTag = dummy;
if( !window.parent.cmCreatePageElementTag ) window.parent.cmCreatePageElementTag = dummy;
if( !window.parent.cmCreateConversionEventTag ) window.parent.cmCreateConversionEventTag = dummy;


// tracking for the homepage slideshow
function doTracking(value) {
pageTracker._trackEvent ('HomepageSlideShow',value);
}

/* main */
var alico = function() {
var pub = {};
/*
var strPub = "test";
function func1() {};
pub.function1 = function(){
   };
   */

pub.init = function() {
/*lets fix that side collumn the lazy js coder way :D*/

if($("#mainContainer").height() < $("#leftPanel").height()) {
var left = $("#leftPanel").height();
$("#mainContainer").height(left + 100);
}

$("#sideNavBox li a").bigTarget();
$(".withImage a.buttonRead").bigTarget({
clickZone : 'div:eq(2)' // jQuery parent selector
});

/* for FAQ - expand the first accordion if there's only one */
if ($("div.accordion.ui-accordion.faq div.acContent").length==1) {
$(".accordion:first h3").click()
}

// fuzzy text in ie6
if ($(".ie6 .fancyProductPanel .tabs .tab")) {
$(".ie6 .fancyProductPanel .tabs .tab").click(function(){
$(".ie6 .productDetails").each(function(e) {
if (($(this).css("filter")!="alpha(opacity=0)") && $(this).css("filter")!="none" || $(this).css("filter")!="auto") {
$(this).css("filter","auto");
}
});
});
}

//fixes ie6 products page issue jumping to bottom
if ($(".promoBox .hContent, .fancyProductPanel").length>0){setTimeout(function(){window.scrollTo(0, 0);$(".dividerContainer .promoBox").hide().show().mouseover()},500)}

/*
inject url params into contact us links in bottomSlideDown
*/
var loadContactLink = function(){
  // set cookie when the page has referral
  var referrer = document.referrer;
  var bMatch = false;
  var ignoredUrls=
   ["http://uae.alico.com",
   "https://uae.alico.com",
   "http://www.uae.alico.com",
   "https://www.aue.alico.com",
   "http://stage.uae.alico.com",
   "https://stage.uae.alico.com",
   "http://secure.uae.alico.com",
   "https://secure.uae.alico.com"];
  var ignoredUrlPattern=/^http(s)?:\/\/(((stage|stage2|stage|teststage|www)\.)?([a-z]{0,3}\.)?alico.com|(www\.)?interamericana.cl)/;

  /*
 for (var i=0; i<ignoredUrls.length; i++) {
   if (referrer.indexOf(ignoredUrls[i])==0) bMatch = true;   
}
*/
if (referrer.match(ignoredUrlPattern)) bMatch = true;   
 
 // if the referrer is not from our domain, then this is the first time. 
 if (!bMatch) {
 /*
   var date = new Date();
   date.setTime(date.getTime()+(1*24*60*60*1000));
 */
   //document.cookie = 'alicoReferral=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
   document.cookie = "alicoReferral="+document.referrer+"; expires='"/*+ date.toGMTString()*/ +"'; path=/"
   window.name = "alicoReferral="+document.referrer;
}

if (referrer=="") {
document.cookie = 'alicoReferral=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
window.name="alicoReferral=;"
}

/*
// contact me buttons
if ($("#bottomSlideDownContent .button[title='Contact me']").length>0) {
   var productType = $("#productType").html();
   if (productType=="" || productType==null) productType="individual";
   var contactLink = $(".bottomSlideDown #bottomSlideDownContent .button[title='Contact me']").attr("href")+"?productType="+productType+"&customerType=new";
   $(".bottomSlideDown #bottomSlideDownContent .button[title='Contact me']").attr("href",contactLink);
}

// contact us on global nav
if ($("#navContainer #navList li a[href*=contact-us.html]").length>0) {
   var eleContactNav = $("#navContainer #navList li a[href*=contact-us.html]");
   var contactLink = eleContactNav.attr("href")+"?productType=individual&customerType=existing";
   eleContactNav.attr("href",contactLink);
}

// submit your contact details link
if ($("#mainPanel .greyParagraph p a:has('strong'):contains('submit your contact details')").length >0 && window.location.toString().indexOf("employee-benefits")>0) {
var eleContactLink = $("#mainPanel .greyParagraph p a:has('strong'):contains('submit your contact details')");
var contactLink = eleContactLink.attr("href")+"?productType=group&customerType=new";
eleContactLink.attr("href",contactLink);    
}

// sitemap link
if (window.location.toString().indexOf("sitemap")>0 && $(".siteMapColumn li ul li a:contains('Contact Us')").length >0) {
var eleContactLink = $(".siteMapColumn li ul li a:contains('Contact Us')");
var contactLink = eleContactLink.attr("href")+"?productType=individual&customerType=existing";
eleContactLink.attr("href",contactLink);    
}
*/
}();// end of loadContactLink

        if ($.browser.msie && $.browser.version == 6) {
            // fix ie 6 bugs on accordions
            $('.accordion').bind('accordionchange', function(event, ui){
                setTimeout(function(){
                    $(".moduleRow .promoBox").hide().show();
                }, 200);
            });
            
            //Mihir: commenting out this below line as this line throws an error and causes all javascript to fail.
            //@Nick - please enable this line, publish this file to Staging UK target        
            DD_belatedPNG.fix('.subbrandlogo img');
        }
};
return pub;
}();
alico.init();


window.alicoPage = {}
window.alicoPage.StoryGallery = {
init: function(){
        if ($(".fancyProductPanel").length > 0) {
            $('<div id="loader"></div>').insertBefore('div#prev');
            $('.mainPanel').each(function(i, el) {
                var n = i + 1;
                $('#prev').addClass('prev' + n);
                $('#next').addClass('next' + n);
            });

            $('.mainPanel').each(function(i, el) {
                var n = i + 1;
                if ($(el).find('.mainPanelSlide').length > 0) {                    
                    $(el).jCarouselLite({
                        btnNext: ".next" + n,
                        btnPrev: ".prev" + n,
                        btnGo: $('#subPanel' + n + " .featuredStory"),
                        speed: 500,
                        circular: true,
                        visible: 1,
                        start: 0,
                        beforeStart: function(a) {
                            $('#subPanelSlide' + n + ' .featuredStory:eq(' + (parseInt(a[0].id.substring(a[0].id.length - 1, a[0].id.length)) - 1).toString() + ')').removeClass("active");
                            $(".fancyProductPanel .mainPanelContainer .mainPanelSlide .content").css("overflow", "hidden");
                        },
                        afterEnd: function(a) {
                            $('#subPanelSlide' + n + ' .featuredStory:eq(' + (parseInt(a[0].id.substring(a[0].id.length - 1, a[0].id.length)) - 1).toString() + ')').addClass("active");
                            setTimeout("$('.fancyProductPanel .mainPanelContainer .mainPanelSlide .content').css('overflow', 'auto');", 0);
                        }
                    })
                }
                else {
                    $(this).css({marginLeft:'-50px'});
                    $(el).find('.mainPanelSlides').css({'visibility':'visible'})
                }
            })
            $(".fancyProductPanel .tabs .tab").each(function(i, el) {
                var n = i + 1;
                $(this).attr('href','#'+n );
            
            
                $(el).click(function() {
                    var $mainPan = $("#mainPanel" + n)
                    if($mainPan.find('.mainPanelSlide').size() > 1){
                        hideShowHelper( $mainPan, $("#subPanelSlide" + n));
                        $('.introPanel:eq(' + i + ')').siblings().hide().end().show();
                        
                        alicoPage.setCarouselClassNames($('#next'),$('#prev'),n);
                    }
                    else{
                      hideShowHelper( $mainPan, $("#subPanelSlide" + n));
                      $mainPan.find('.mainPanelSlide').show();  
                    }
                    $(this).addClass("active");
                   // return false;
                })

            });


            function initializeSet() {
                $('.introPanel:eq(0)').show().siblings().hide()
                $('.mainPanel').each(function(i, el) {
                    var n = i + 1;
                    if (i > 0) {

                        $(el).hide();
                        $(el).fadeTo(1, 1);
                        $('#subPanelSlide' + n).hide();
                    }
                    $('#subPanelSlide' + n + ' .featuredStory:eq(0)').addClass('active');
                })
                //$("#prev").attr("class","prev1");
                //$("#next").attr("class","next1");
                $('#loader').hide();
            }

            function hideShowHelper(ele1, ele2) {
                $('.subPanelSlide .featuredStory:eq(0)').click();
                $(".mainPanel").newFadeOut(0);
                $(".subPanelSlide").newFadeOut(0);
                $(".fancyProductPanel .tabs a.tab").removeClass("active");
                ele1.show(300,function(){ele1.css("filter","auto")});
                ele2.show(300,function(){ele2.css("filter","auto")});
            }


            initializeSet();



         $(window).bind( 'hashchange', function(e) {
            var url = $.param.fragment() -1;
            if ($('a.tab').eq(url).hasClass('active')){
              return false;
            }else{
             $('a.tab').eq(url).trigger('click');   
            }
          });
        
          $(window).trigger( 'hashchange' );
        }
    
    }
}
window.alicoPage.ProductFinder = {
    init : function(){
        
        if ($(".fancyProductPanel").length > 0) {
                $('<div id="loader"></div>').insertBefore('div#prev');
                $('.subPanelSlide').each(function(i,el){
                var n = i+1;
                $('#prev').addClass('prev' + n);
                $('#next').addClass('next' + n);
            });

        $('<input type="button" style="display:none;" value="to Zero" class="toZero"/>').appendTo($('.subPanel'))
        
        $('.subPanelSlide').each(function(i,el){ 
            var n = i+1;
            if($(el).find('.productDescription').size() > 4){
                $(el).find('.productDescriptions').jCarouselLite({
                    btnNext: ".next" + n, 
                    btnPrev: ".prev" + n, 
                    speed: 500, 
                    circular: false, 
                    visible: 4,
                    start: 0,
                    scroll:1,
                    btnGo: ['input.toZero'],
                    beforeStart:function(a){
                    
                    },
                    afterEnd: function(a){
                        $('.current').removeClass('current');
                        $(a[0]).addClass('current');
                        console.log(a[0] + " ");
                        $('#subPanelSlide' + n + ' .productDescription:eq('+ (parseInt(a[0].id.substring(a[0].id.length -1, a[0].id.length)) - 1).toString() +')').addClass("active");                    
                    } 
                })
            }        
        })
        $(".fancyProductPanel .tabs .tab").each(function(i, el){
            var n = i + 1;
            $(this).attr('href','#'+n );
              
            $(el).click(function(){
                hideShowHelper($("#mainPanel" + n),$("#subPanelSlide" + n));
                $(this).addClass("active");
                
                alicoPage.setCarouselClassNames($('#next'),$('#prev'),n);
    
                if($('#subPanelSlide'+n).find('.productDescription').size() > 4){
                    $('input.toZero').click();
                }
                else{
                    $("#prev, #next").addClass('disabled');
                }
      //  return false;
        })

        }) 


        function initializeSet(){
            $('.mainPanel').each(function(i,el){
                var n = i+1;
                if(i > 0){
                    $(el).hide();
                    $('#subPanelSlide'+n).hide();
                }
                $('#subPanelSlide'+n+' .featuredStory:eq(0)').addClass('active');
            }) 

            $("#prev").attr("class","prev1 disabled");
            $("#next").attr("class","next1");
            $('#loader').hide();

            $('input.toZero').click();
            $('.fancyProductPanel .tabs .tab:eq(0)').click();
        } 

        function hideShowHelper(ele1,ele2) {        
            $(".mainPanel").hide(200);
            $(".subPanelSlide").hide(200);
            $(".fancyProductPanel .tabs a.tab").removeClass("active");
            ele1.show(500,function(){ele1.css("filter","auto")});
            ele2.show(500,function(){ele2.css("filter","auto")});
if (console.log) console.log(ele1.css("filter"));
        }
        initializeSet();

         $(window).bind( 'hashchange', function(e) {
            var url = $.param.fragment() -1;
            if ($('a.tab').eq(url).hasClass('active')){
              return false;
            }else{
             $('a.tab').eq(url).trigger('click');   
            }
          });
        
          $(window).trigger( 'hashchange' );
        }        
    }
}

alicoPage.setCarouselClassNames = function($next,$prev,n){
    if($next.get(0).className.indexOf('next') > -1){
        var nextClass = $next.attr('class').match(/\bnext\d+\b/);
        if(nextClass){
            $next.removeClass(nextClass);
        }                    
    }
    $next.addClass("next"+n); 

    if($prev.get(0).className.indexOf('prev') > -1){
        var prevClass = $prev.attr('class').match(/\bprev\d+\b/);
        if(prevClass){
            $prev.removeClass(prevClass);
        }                    
    }
    $prev.addClass("prev"+n);
};


/*
 *
 * Text sizer
$("*").each(function(el){
    var size = parseInt($(this).css("font-size").replace(/px/, ""));
    var newSize = size + 2 + "px";
    $(this).css("font-size",newSize);
})
 * 
 * 
 */
 
 // public function
 
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));
}
  }
  
  if (window.name!="")
  {
  c_start=window.name.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=window.name.length;
return unescape(window.name.substring(c_start,c_end));
}
  }
return "";
}