//** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com

//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/

//** Menu created: Nov 12, 2008



//** Dec 12th, 08" (v1.01): Fixed Shadow issue when multiple LIs within the same UL (level) contain sub menus: http://www.dynamicdrive.com/forums/showthread.php?t=39177&highlight=smooth



//** Feb 11th, 09" (v1.02): The currently active main menu item (LI A) now gets a CSS class of ".selected", including sub menu items.



//** May 1st, 09" (v1.3):

//** 1) Now supports vertical (side bar) menu mode- set "orientation" to 'v'

//** 2) In IE6, shadows are now always disabled





var ddsmoothmenu={



//Specify full URL to down and right arrow images (23 is padding-right added to top level LIs with drop downs):

arrowimages: {down:['downarrowclass', '/images/down.gif', 23], right:['rightarrowclass', '/images/right.gif']},



transition: {overtime:300, outtime:100}, //duration of slide in/ out animation, in milliseconds

shadow: {enabled:false, offsetx:0, offsety:0},



///////Stop configuring beyond here///////////////////////////



detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, //detect WebKit browsers (Safari, Chrome etc)

detectie6: document.all && !window.XMLHttpRequest,



getajaxmenu:function($, setting){ //function to fetch external page containing the panel DIVs

  var $menucontainer=$('#'+setting.contentsource[0]) //reference empty div on page that will hold menu

  // Don't have loading message, there is a default menu instead

  //$menucontainer.html("Loading Menu...")

  $.ajax({

    url: setting.contentsource[1], //path to external menu file

    async: true,

    error:function(ajaxrequest){

    	// Don't have loading message, there is a default menu instead

    	//$menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText)

    },

    success:function(content){

      $menucontainer.html(content)

      ddsmoothmenu.buildmenu($, setting)

    }

  })

},





buildmenu:function($, setting){

  var smoothmenu=ddsmoothmenu

  var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL

  $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu"

  var $headers=$mainmenu.find("ul").parent()

  $headers.hover(

    function(e){

      $(this).children('a:eq(0)').addClass('selected')

    },

    function(e){

      $(this).children('a:eq(0)').removeClass('selected')

    }

  )

  $headers.each(function(i){ //loop through each LI header

    var $curobj=$(this).css({zIndex: 100-i}) //reference current LI header

    var $subul=$(this).find('ul:eq(0)').css({display:'block'})

    this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}

    this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header?

    $subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0})

    $curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: smoothmenu.arrowimages.down[2]} : {}).append( //add arrow images

      '<img src="'+ (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[1] : smoothmenu.arrowimages.right[1])

      +'" class="' + (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[0] : smoothmenu.arrowimages.right[0])

      + '" style="border:0;" />'

    )

    if (smoothmenu.shadow.enabled){

      this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx : this._dimensions.w), y:(this.istopheader? $subul.offset().top+smoothmenu.shadow.offsety : $curobj.position().top)} //store this shadow's offsets

      if (this.istopheader)

        $parentshadow=$(document.body)

      else{

        var $parentLi=$curobj.parents("li:eq(0)")

        $parentshadow=$parentLi.get(0).$shadow

      }

      this.$shadow=$('<div class="ddshadow'+(this.istopheader? ' toplevelshadow' : '')+'"></div>').prependTo($parentshadow).css({left:this._shadowoffset.x+'px', top:this._shadowoffset.y+'px'})  //insert shadow DIV and set it to parent node for the next shadow div

    }

    $curobj.hover(

      function(e){

        var $targetul=$(this).children("ul:eq(0)")

        this._offsets={left:$(this).offset().left, top:$(this).offset().top}

        var menuleft=this.istopheader && setting.orientation!='v'? 0 : this._dimensions.w

        menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader && setting.orientation!='v'? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft //calculate this sub menu's offsets from its parent

        if ($targetul.queue().length<=1){ //if 1 or less queued animations

          $targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime)

          if (smoothmenu.shadow.enabled){

            var shadowleft=this.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft

            var shadowtop=this.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : this._shadowoffset.y

            if (!this.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full

              this.$shadow.css({opacity:1})

            }

            this.$shadow.css({overflow:'', width:this._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:this._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime)

          }

        }

      },

      function(e){

        var $targetul=$(this).children("ul:eq(0)")

        $targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime)

        if (smoothmenu.shadow.enabled){

          if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them

            this.$shadow.children('div:eq(0)').css({opacity:0})

          }

          this.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime)

        }

      }

    ) //end hover

  }) //end $headers.each()

  $mainmenu.find("ul").css({display:'none', visibility:'visible'})

},



init:function(setting){

  if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set?

    var mainmenuid='#'+setting.mainmenuid

    var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid

    document.write('<style type="text/css">\n'

      +mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n'

      +mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n'

    +'</style>')

  }

  this.shadow.enabled=(document.all && !window.XMLHttpRequest)? false : true //in IE6, always disable shadow

  jQuery(document).ready(function($){ //ajax menu?

    if (typeof setting.contentsource=="object"){ //if external ajax menu

      ddsmoothmenu.getajaxmenu($, setting)

    }

    else{ //else if markup menu

      ddsmoothmenu.buildmenu($, setting)

    }

  })

}



} //end ddsmoothmenu variable



//Initialize Menu instance(s):



















/* Nifty Corners Cube - rounded corners with CSS and Javascript

Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it)



This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License, or

(at your option) any later version.



This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

GNU General Public License for more details.



You should have received a copy of the GNU General Public License

along with this program; if not, write to the Free Software

Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/



var niftyOk=(document.getElementById && document.createElement && Array.prototype.push);

var niftyCss=false;



String.prototype.find=function(what){

return(this.indexOf(what)>=0 ? true : false);

}



/*  Commented out loading of nifty using jQuery instead



var oldonload=window.onload;

if(typeof(NiftyLoad)!='function') NiftyLoad=function(){};

if(typeof(oldonload)=='function')

    window.onload=function(){oldonload();AddCss();NiftyLoad()};

else window.onload=function(){AddCss();NiftyLoad()};

*/

//jQuery version of loading 

//$(document).ready(function(){

//	AddCss();

//	NiftyLoad();

//});







function AddCss(){

niftyCss=true;

var l=CreateEl("link");

l.setAttribute("type","text/css");

l.setAttribute("rel","stylesheet");

l.setAttribute("href","/niftyCorners.css");

l.setAttribute("media","screen");

document.getElementsByTagName("head")[0].appendChild(l);

}



function Nifty(selector,options){

if(niftyOk==false) return;

if(niftyCss==false) AddCss();

var i,v=selector.split(","),h=0;

if(options==null) options="";

if(options.find("fixed-height"))

    h=getElementsBySelector(v[0])[0].offsetHeight;

for(i=0;i<v.length;i++)

    Rounded(v[i],options);

if(options.find("height")) SameHeight(selector,h);

}



function Rounded(selector,options){

var i,top="",bottom="",v=new Array();

if(options!=""){

    options=options.replace("left","tl bl");

    options=options.replace("right","tr br");

    options=options.replace("top","tr tl");

    options=options.replace("bottom","br bl");

    options=options.replace("transparent","alias");

    if(options.find("tl")){

        top="both";

        if(!options.find("tr")) top="left";

        }

    else if(options.find("tr")) top="right";

    if(options.find("bl")){

        bottom="both";

        if(!options.find("br")) bottom="left";

        }

    else if(options.find("br")) bottom="right";

    }

if(top=="" && bottom=="" && !options.find("none")){top="both";bottom="both";}

v=getElementsBySelector(selector);

for(i=0;i<v.length;i++){

    FixIE(v[i]);

    if(top!="") AddTop(v[i],top,options);

    if(bottom!="") AddBottom(v[i],bottom,options);

    }

}



function AddTop(el,side,options){

var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;

d.style.marginLeft="-"+getPadding(el,"Left")+"px";

d.style.marginRight="-"+getPadding(el,"Right")+"px";

if(options.find("alias") || (color=getBk(el))=="transparent"){

    color="transparent";bk="transparent"; border=getParentBk(el);btype="t";

    }

else{

    bk=getParentBk(el); border=Mix(color,bk);

    }

d.style.background=bk;

d.className="niftycorners";

p=getPadding(el,"Top");

if(options.find("small")){

    d.style.marginBottom=(p-2)+"px";

    btype+="s"; lim=2;

    }

else if(options.find("big")){

    d.style.marginBottom=(p-10)+"px";

    btype+="b"; lim=8;

    }

//MASTI HACK - for extra large 20px corner

else if(options.find("ext")){

    d.style.marginBottom=(p-20)+"px";

    btype+="e"; lim=13;

    }

else d.style.marginBottom=(p-5)+"px";

for(i=1;i<=lim;i++)

    d.appendChild(CreateStrip(i,side,color,border,btype));

el.style.paddingTop="0";

el.insertBefore(d,el.firstChild);

}



function AddBottom(el,side,options){

var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;

d.style.marginLeft="-"+getPadding(el,"Left")+"px";

d.style.marginRight="-"+getPadding(el,"Right")+"px";

if(options.find("alias") || (color=getBk(el))=="transparent"){

    color="transparent";bk="transparent"; border=getParentBk(el);btype="t";

    }

else{

    bk=getParentBk(el); border=Mix(color,bk);

    }

d.style.background=bk;

d.className="niftycorners";

p=getPadding(el,"Bottom");

if(options.find("small")){

    d.style.marginTop=(p-2)+"px";

    btype+="s"; lim=2;

    }

else if(options.find("big")){

    d.style.marginTop=(p-10)+"px";

    btype+="b"; lim=8;

    }

    //MASTI HACK - for extra large 20px corner

else if(options.find("ext")){

    d.style.marginTop=(p-20)+"px";

    btype+="e"; lim=13;

    }

else d.style.marginTop=(p-5)+"px";

for(i=lim;i>0;i--)

    d.appendChild(CreateStrip(i,side,color,border,btype));

el.style.paddingBottom=0;

el.appendChild(d);

}



function CreateStrip(index,side,color,border,btype){

var x=CreateEl("b");

x.className=btype+index;

x.style.backgroundColor=color;

x.style.borderColor=border;

if(side=="left"){

    x.style.borderRightWidth="0";

    x.style.marginRight="0";

    }

else if(side=="right"){

    x.style.borderLeftWidth="0";

    x.style.marginLeft="0";

    }

return(x);

}



function CreateEl(x){

return(document.createElement(x));

}



function FixIE(el){

if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false)

    el.style.display="inline-block";

}



function SameHeight(selector,maxh){

var i,v=selector.split(","),t,j,els=[],gap;

for(i=0;i<v.length;i++){

    t=getElementsBySelector(v[i]);

    els=els.concat(t);

    }

for(i=0;i<els.length;i++){

    if(els[i].offsetHeight>maxh) maxh=els[i].offsetHeight;

    els[i].style.height="auto";

    }

for(i=0;i<els.length;i++){

    gap=maxh-els[i].offsetHeight;

    if(gap>0){

        t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px";

        nc=els[i].lastChild;

        if(nc.className=="niftycorners")

            els[i].insertBefore(t,nc);

        else els[i].appendChild(t);

        }

    }

}



function getElementsBySelector(selector){

var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c;

if(selector.find("#")){ //id selector like "tag#id"

    if(selector.find(" ")){  //descendant selector like "tag#id tag"

        s=selector.split(" ");

        var fs=s[0].split("#");

        if(fs.length==1) return(objlist);

        f=document.getElementById(fs[1]);

        if(f){

            v=f.getElementsByTagName(s[1]);

            for(i=0;i<v.length;i++) objlist.push(v[i]);

            }

        return(objlist);

        }

    else{

        s=selector.split("#");

        tag=s[0];

        selid=s[1];

        if(selid!=""){

            f=document.getElementById(selid);

            if(f) objlist.push(f);

            return(objlist);

            }

        }

    }

if(selector.find(".")){      //class selector like "tag.class"

    s=selector.split(".");

    tag=s[0];

    selclass=s[1];

    if(selclass.find(" ")){   //descendant selector like tag1.classname tag2

        s=selclass.split(" ");

        selclass=s[0];

        tag2=s[1];

        }

    }

var v=document.getElementsByTagName(tag);  // tag selector like "tag"

if(selclass==""){

    for(i=0;i<v.length;i++) objlist.push(v[i]);

    return(objlist);

    }

for(i=0;i<v.length;i++){

    c=v[i].className.split(" ");

    for(j=0;j<c.length;j++){

        if(c[j]==selclass){

            if(tag2=="") objlist.push(v[i]);

            else{

                v2=v[i].getElementsByTagName(tag2);

                for(k=0;k<v2.length;k++) objlist.push(v2[k]);

                }

            }

        }

    }

return(objlist);

}



function getParentBk(x){

var el=x.parentNode,c;

while(el.tagName.toUpperCase()!="HTML" && (c=getBk(el))=="transparent")

    el=el.parentNode;

if(c=="transparent") c="#FFFFFF";

return(c);

}



function getBk(x){

var c=getStyleProp(x,"backgroundColor");

if(c==null || c=="transparent" || c.find("rgba(0, 0, 0, 0)"))

    return("transparent");

if(c.find("rgb")) c=rgb2hex(c);

return(c);

}



function getPadding(x,side){

var p=getStyleProp(x,"padding"+side);

if(p==null || !p.find("px")) return(0);

return(parseInt(p));

}



function getStyleProp(x,prop){

if(x.currentStyle)

    return(x.currentStyle[prop]);

if(document.defaultView.getComputedStyle)

    return(document.defaultView.getComputedStyle(x,'')[prop]);

return(null);

}



function rgb2hex(value){

var hex="",v,h,i;

var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;

var h=regexp.exec(value);

for(i=1;i<4;i++){

    v=parseInt(h[i]).toString(16);

    if(v.length==1) hex+="0"+v;

    else hex+=v;

    }

return("#"+hex);

}



function Mix(c1,c2){

var i,step1,step2,x,y,r=new Array(3);

if(c1.length==4)step1=1;

else step1=2;

if(c2.length==4) step2=1;

else step2=2;

for(i=0;i<3;i++){

    x=parseInt(c1.substr(1+step1*i,step1),16);

    if(step1==1) x=16*x+x;

    y=parseInt(c2.substr(1+step2*i,step2),16);

    if(step2==1) y=16*y+y;

    r[i]=Math.floor((x*50+y*50)/100);

    r[i]=r[i].toString(16);

    if(r[i].length==1) r[i]="0"+r[i];

    }

return("#"+r[0]+r[1]+r[2]);

}











/* Ultimate Fade-in slideshow (v2.1)

* Last updated: Sept 10th, 2009. This notice must stay intact for usage 

* Author: Dynamic Drive at http://www.dynamicdrive.com/

* Visit http://www.dynamicdrive.com/ for full source code

*/



//Oct 6th, 09' (v2.1): Adds option to randomize display order of images, via new option displaymode.randomize



var fadeSlideShow_descpanel={

	controls: [['/images/x.png',7,7], ['/images/restore.png',10,11], ['/images/loading.gif',54,55]], //full URL and dimensions of close, restore, and loading images

	fontStyle: 'normal 11px Verdana', //font style for text descriptions

	slidespeed: 200 //speed of description panel animation (in millisec)

}



//No need to edit beyond here...



jQuery = $;



function fadeSlideShow(settingarg){

	this.setting=settingarg

	settingarg=null

	var setting=this.setting

	setting.fadeduration=setting.fadeduration? parseInt(setting.fadeduration) : 500

	setting.curimage=(setting.persist)? fadeSlideShow.routines.getCookie("gallery-"+setting.wrapperid) : 0

	setting.curimage=setting.curimage || 0 //account for curimage being null if cookie is empty

	setting.currentstep=0 //keep track of # of slides slideshow has gone through (applicable in displaymode='auto' only)

	setting.totalsteps=setting.imagearray.length*(setting.displaymode.cycles>0? setting.displaymode.cycles : Infinity) //Total steps limit (applicable in displaymode='auto' only w/ cycles>0)

	setting.fglayer=0, setting.bglayer=1 //index of active and background layer (switches after each change of slide)

	setting.oninit=setting.oninit || function(){}

	setting.onslide=setting.onslide || function(){}

	if (setting.displaymode.randomize) //randomly shuffle order of images?

		setting.imagearray.sort(function() {return 0.5 - Math.random()})

	var preloadimages=[] //preload images

	setting.longestdesc="" //get longest description of all slides. If no desciptions defined, variable contains ""

	for (var i=0; i<setting.imagearray.length; i++){ //preload images

		preloadimages[i]=new Image()

		preloadimages[i].src=setting.imagearray[i][0]

		if (setting.imagearray[i][3] && setting.imagearray[i][3].length>setting.longestdesc.length)

			setting.longestdesc=setting.imagearray[i][3]

	}

	var closebutt=fadeSlideShow_descpanel.controls[0] //add close button to "desc" panel if descreveal="always"

	setting.closebutton=(setting.descreveal=="always")? '<img class="close" src="'+closebutt[0]+'" style="float:right;cursor:hand;cursor:pointer;width:'+closebutt[1]+'px;height:'+closebutt[2]+'px;margin-left:2px" title="Hide Description" />' : ''

	var slideshow=this

	jQuery(document).ready(function($){ //fire on DOM ready

		var setting=slideshow.setting

		var fullhtml=fadeSlideShow.routines.getFullHTML(setting.imagearray) //get full HTML of entire slideshow

		setting.$wrapperdiv=$('#'+setting.wrapperid).css({position:'relative', visibility:'visible', background:'white', overflow:'hidden', width:setting.dimensions[0], height:setting.dimensions[1]}).empty() //main slideshow DIV

		if (setting.$wrapperdiv.length==0){ //if no wrapper DIV found

			alert("Error: DIV with ID \""+setting.wrapperid+"\" not found on page.")

			return

		}

		setting.$gallerylayers=$('<div class="gallerylayer"></div><div class="gallerylayer"></div>') //two stacked DIVs to display the actual slide 

			.css({position:'absolute', left:0, top:0, width:'100%', height:'100%', background:'white'})

			.appendTo(setting.$wrapperdiv)

		var $loadingimg=$('<img src="'+fadeSlideShow_descpanel.controls[2][0]+'" style="position:absolute;width:'+fadeSlideShow_descpanel.controls[2][1]+';height:'+fadeSlideShow_descpanel.controls[2][2]+'" />')

			.css({left:setting.dimensions[0]/2-fadeSlideShow_descpanel.controls[2][1]/2, top:setting.dimensions[1]/2-fadeSlideShow_descpanel.controls[2][2]}) //center loading gif

			.appendTo(setting.$wrapperdiv)

		var $curimage=setting.$gallerylayers.html(fullhtml).find('img').hide().eq(setting.curimage) //prefill both layers with entire slideshow content, hide all images, and return current image

		if (setting.longestdesc!=""){ //if at least one slide contains a description (feature is enabled)

			fadeSlideShow.routines.adddescpanel($, setting)

			if (setting.descreveal=="always"){ //position desc panel so it's visible to begin with

				setting.$descpanel.css({top:setting.dimensions[1]-setting.panelheight})

				setting.$descinner.click(function(e){ //asign click behavior to "close" icon

					if (e.target.className=="close"){

						slideshow.showhidedescpanel('hide')

					}

				})

				setting.$restorebutton.click(function(e){ //asign click behavior to "restore" icon

					slideshow.showhidedescpanel('show')

					$(this).css({visibility:'hidden'})

				})

			}

			else{ //display desc panel on demand (mouseover)

				setting.$wrapperdiv.bind('mouseenter', function(){slideshow.showhidedescpanel('show')})

				setting.$wrapperdiv.bind('mouseleave', function(){slideshow.showhidedescpanel('hide')})

			}

		}

		setting.$wrapperdiv.bind('mouseenter', function(){setting.ismouseover=true}) //pause slideshow mouseover

		setting.$wrapperdiv.bind('mouseleave', function(){setting.ismouseover=false})

		if ($curimage.get(0).complete){ //accounf for IE not firing image.onload

			$loadingimg.hide()

			slideshow.paginateinit($)

			slideshow.showslide(setting.curimage)

		}

		else{ //initialize slideshow when first image has fully loaded

			$loadingimg.hide()

			slideshow.paginateinit($)

			$curimage.bind('load', function(){slideshow.showslide(setting.curimage)})

		}

		setting.oninit.call(slideshow) //trigger oninit() event

		$(window).bind('unload', function(){ //clean up and persist

			if (slideshow.setting.persist) //remember last shown image's index

				fadeSlideShow.routines.setCookie("gallery-"+setting.wrapperid, setting.curimage)

			jQuery.each(slideshow.setting, function(k){

				if (slideshow.setting[k] instanceof Array){

					for (var i=0; i<slideshow.setting[k].length; i++){

						if (slideshow.setting[k][i].tagName=="DIV") //catches 2 gallerylayer divs, gallerystatus div

							slideshow.setting[k][i].innerHTML=null

						slideshow.setting[k][i]=null

					}

				}

			})

			slideshow=slideshow.setting=null

		})

	})

}



fadeSlideShow.prototype={



	navigate:function(keyword){

		var setting=this.setting

		clearTimeout(setting.playtimer)

		if (setting.displaymode.type=="auto"){ //in auto mode

			setting.displaymode.type="manual" //switch to "manual" mode when nav buttons are clicked on

			setting.displaymode.wraparound=true //set wraparound option to true

		}

		if (!isNaN(parseInt(keyword))){ //go to specific slide?

			this.showslide(parseInt(keyword))

		}

		else if (/(prev)|(next)/i.test(keyword)){ //go back or forth inside slide?

			this.showslide(keyword.toLowerCase())

		}

	},



	showslide:function(keyword){

		var slideshow=this

		var setting=slideshow.setting

		if (setting.displaymode.type=="auto" && setting.ismouseover && setting.currentstep<=setting.totalsteps){ //if slideshow in autoplay mode and mouse is over it, pause it

			setting.playtimer=setTimeout(function(){slideshow.showslide('next')}, setting.displaymode.pause)

			return

		}

		var totalimages=setting.imagearray.length

		var imgindex=(keyword=="next")? (setting.curimage<totalimages-1? setting.curimage+1 : 0)

			: (keyword=="prev")? (setting.curimage>0? setting.curimage-1 : totalimages-1)

			: Math.min(keyword, totalimages-1)

		var $slideimage=setting.$gallerylayers.eq(setting.bglayer).find('img').hide().eq(imgindex).show() //hide all images except current one

		var imgdimensions=[$slideimage.width(), $slideimage.height()] //center align image

		$slideimage.css({marginLeft: (imgdimensions[0]>0 && imgdimensions[0]<setting.dimensions[0])? setting.dimensions[0]/2-imgdimensions[0]/2 : 0})

		$slideimage.css({marginTop: (imgdimensions[1]>0 && imgdimensions[1]<setting.dimensions[1])? setting.dimensions[1]/2-imgdimensions[1]/2 : 0})

		setting.$gallerylayers.eq(setting.bglayer).css({zIndex:100, opacity:0}) //background layer becomes foreground

			.stop().css({opacity:0}).animate({opacity:1}, setting.fadeduration, function(){ //Callback function after fade animation is complete:

				clearTimeout(setting.playtimer)

				try{

					setting.onslide.call(slideshow, setting.$gallerylayers.eq(setting.fglayer).get(0), setting.curimage)

				}catch(e){

					alert("Fade In Slideshow error: An error has occured somwhere in your code attached to the \"onslide\" event: "+e)

				}

				setting.currentstep+=1

				if (setting.displaymode.type=="auto"){

					if (setting.currentstep<=setting.totalsteps || setting.displaymode.cycles==0)

						setting.playtimer=setTimeout(function(){slideshow.showslide('next')}, setting.displaymode.pause)

				}

			}) //end callback function

		setting.$gallerylayers.eq(setting.fglayer).css({zIndex:99}) //foreground layer becomes background

		setting.fglayer=setting.bglayer

		setting.bglayer=(setting.bglayer==0)? 1 : 0

		setting.curimage=imgindex

		if (setting.$descpanel)

			setting.$descpanel.css({visibility:(setting.imagearray[imgindex][3])? 'visible' : 'hidden'})

		if (setting.imagearray[imgindex][3])

			setting.$descinner.empty().html(setting.closebutton + setting.imagearray[imgindex][3])

		if (setting.displaymode.type=="manual" && !setting.displaymode.wraparound){

			this.paginatecontrol()

		}

		if (setting.$status) //if status container defined

			setting.$status.html(setting.curimage+1 + "/" + totalimages)

	},



	showhidedescpanel:function(state, showcontrol){

		var setting=this.setting

		var endpoint=(state=="show")? setting.dimensions[1]-setting.panelheight : this.setting.dimensions[1]

		setting.$descpanel.stop().animate({top:endpoint}, fadeSlideShow_descpanel.slidespeed, function(){

			if (setting.descreveal=="always" && state=="hide")

				setting.$restorebutton.css({visibility:'visible'}) //show restore button

		})

	},



	paginateinit:function($){

		var slideshow=this

		var setting=this.setting

		if (setting.togglerid){ //if toggler div defined

			setting.$togglerdiv=$("#"+setting.togglerid)

			setting.$prev=setting.$togglerdiv.find('.prev').data('action', 'prev')

			setting.$next=setting.$togglerdiv.find('.next').data('action', 'next')

			setting.$prev.add(setting.$next).click(function(e){ //assign click behavior to prev and next controls

				var $target=$(this)

				slideshow.navigate($target.data('action'))

				e.preventDefault()

			})

			setting.$status=setting.$togglerdiv.find('.status')

		}

	},



	paginatecontrol:function(){

		var setting=this.setting

			setting.$prev.css({opacity:(setting.curimage==0)? 0.4 : 1}).data('action', (setting.curimage==0)? 'none' : 'prev')

			setting.$next.css({opacity:(setting.curimage==setting.imagearray.length-1)? 0.4 : 1}).data('action', (setting.curimage==setting.imagearray.length-1)? 'none' : 'next')

			if (document.documentMode==8){ //in IE8 standards mode, apply opacity to inner image of link

				setting.$prev.find('img:eq(0)').css({opacity:(setting.curimage==0)? 0.4 : 1})

				setting.$next.find('img:eq(0)').css({opacity:(setting.curimage==setting.imagearray.length-1)? 0.4 : 1})

			}

	}



	

}



fadeSlideShow.routines={



	getSlideHTML:function(imgelement){

		var layerHTML=(imgelement[1])? '<a href="'+imgelement[1]+'" target="'+imgelement[2]+'">\n' : '' //hyperlink slide?

		layerHTML+='<img src="'+imgelement[0]+'" style="border-width:0;" />\n'

		layerHTML+=(imgelement[1])? '</a>\n' : ''

		return layerHTML //return HTML for this layer

	},



	getFullHTML:function(imagearray){

		var preloadhtml=''

		for (var i=0; i<imagearray.length; i++)

			preloadhtml+=this.getSlideHTML(imagearray[i])

		return preloadhtml

	},



	adddescpanel:function($, setting){

		setting.$descpanel=$('<div class="fadeslidedescdiv"></div>')

			.css({position:'absolute', visibility:'hidden', width:'100%', left:0, top:setting.dimensions[1], font:fadeSlideShow_descpanel.fontStyle, zIndex:'101'})

			.appendTo(setting.$wrapperdiv)

		$('<div class="descpanelbg"></div><div class="descpanelfg"></div>') //create inner nav panel DIVs

			.css({position:'absolute', left:0, top:0, width:setting.$descpanel.width()-8, padding:'4px'})

			.eq(0).css({background:'black', opacity:0.7}).end() //"descpanelbg" div

			.eq(1).css({color:'white'}).html(setting.closebutton + setting.longestdesc).end() //"descpanelfg" div

			.appendTo(setting.$descpanel)

		setting.$descinner=setting.$descpanel.find('div.descpanelfg')

		setting.panelheight=setting.$descinner.outerHeight()

		setting.$descpanel.css({height:setting.panelheight}).find('div').css({height:'100%'})

		if (setting.descreveal=="always"){ //create restore button

			setting.$restorebutton=$('<img class="restore" title="Restore Description" src="' + fadeSlideShow_descpanel.controls[1][0] +'" style="position:absolute;visibility:hidden;right:0;bottom:0;z-index:1002;width:'+fadeSlideShow_descpanel.controls[1][1]+'px;height:'+fadeSlideShow_descpanel.controls[1][2]+'px;cursor:pointer;cursor:hand" />')

				.appendTo(setting.$wrapperdiv)





		}

	},





	getCookie:function(Name){ 

		var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair

		if (document.cookie.match(re)) //if cookie found

			return document.cookie.match(re)[0].split("=")[1] //return its value

		return null

	},



	setCookie:function(name, value){

		document.cookie = name+"=" + value + ";path=/"

	}

}

















































//Menu

ddsmoothmenu.init({

  mainmenuid: "menuleft", //menu DIV id

  orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"

  classname: 'ddsmoothmenu-v', //class added to menu's outer DIV

  //customtheme: ["#1c5a80", "#18374a"],

  //contentsource: "markup"

  contentsource: ["menuleft", maspmenu] //"markup" or ["container_id", "path_to_menu_file"]

})





//Rounded Corners

NiftyLoad=function(){

Nifty("div.article","ext transparent top bottom");

Nifty("div.infopage","ext transparent top bottom");

Nifty("div.category","ext transparent top bottom");

Nifty("div.links","ext transparent top bottom");

Nifty("div.resources","ext transparent top bottom");

Nifty("div.relatednav a","big transparent top");

Nifty("div.relatedtext","big transparent");

Nifty("td.headernew","ext transparent top bottom");



if (maspcode=='home') {

Nifty("div.featuredcategory","ext transparent top bottom same-height");

Nifty("div.latestarticles","ext transparent top bottom");

Nifty("div.featuredarticles","ext transparent top bottom");

Nifty("div.news-no-flash","ext transparent top bottom");

Nifty("div.signup","ext transparent top bottom");
Nifty("div.homeText","ext transparent top bottom");

}

}



//Common stuff for flash

var flashvars = false;

var params = {wmode: "transparent", scale: "noscale", salign: "tl"};

var attributes = false;



//Header Images - headerImages is defined in header.php

var mygallery=new fadeSlideShow({

	wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow

	dimensions: [580, 90], //width/height of gallery in pixels. Should reflect dimensions of largest image

	imagearray: headerImages, //no trailing comma after very last image element!

	displaymode: {type:'auto', pause:4000, cycles:0, wraparound:true, randomize:true},//displaymode: {type:'auto|manual', pause:milliseconds, cycles:0|integer, wraparound:true|false, randomize:true|false},

	persist: false, //remember last viewed slide and recall within same session?

	fadeduration: 500, //transition duration (milliseconds)

	descreveal: "ondemand",//always or ondemand

	togglerid: "fadeshow1toggler"

})



//Google Analytics

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-12793429-1']);

_gaq.push(['_trackPageview']);

$(document).ready(function() {	

  $.getScript(('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js');

});





//Add This Variables

var addthis_pub="dilesh";

var addthis_brand = "Masti Design"
