/* Superfish v1.4.8 - jQuery menu widget - Copyright (c) 2008 Joel Birch */
;(function($){$.fn.superfish=function(op){var sf=$.fn.superfish,c=sf.c,$arrow=$(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),over=function(){var $$=$(this),menu=getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl()},out=function(){var $$=$(this),menu=getMenu($$),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();if(o.$path.length&&$$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path)}},o.delay)},getMenu=function($menu){var menu=$menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu},addArrow=function($a){$a.addClass(c.anchorClass).append($arrow.clone())};return this.each(function(){var s=this.serial=sf.o.length;var o=$.extend({},sf.defaults,op);o.$path=$('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass)});sf.o[s]=sf.op=o;$('li:has(ul)',this)[($.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow($('>a:first-child',this))}).not('.'+c.bcClass).hideSuperfishUl();var $a=$('a',this);$a.each(function(i){var $li=$a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li)}).blur(function(){out.call($li)})});o.onInit.call(this)}).each(function(){var menuClasses=[c.menuClass];if(sf.op.dropShadows&&!($.browser.msie&&$.browser.version<7))menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '))})};var sf=$.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if($.browser.msie&&$.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined)this.toggleClass(sf.c.shadowClass+'-off')};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:800,animation:{opacity:'show'},speed:'normal',autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};$.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.$path:'';o.retainPath=false;var $ul=$(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call($ul);return this},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',$ul=this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,function(){sf.IE7fix.call($ul);o.onShow.call($ul)});return this}})})(jQuery);

//popup//
jQuery.fn.popupwindow=function(p){var profiles=p||{};return this.each(function(index){var settings,parameters,mysettings,b,a;mysettings=(jQuery(this).attr("rel")||"").split(",");settings={height:600,width:600,toolbar:0,scrollbars:0,status:0,resizable:1,left:0,top:0,center:0,createnew:1,location:0,menubar:0};if(mysettings.length==1&&mysettings[0].split(":").length==1){a=mysettings[0];if(typeof profiles[a]!="undefined"){settings=jQuery.extend(settings,profiles[a])}}else{for(var i=0;i<mysettings.length;i++){b=mysettings[i].split(":");if(typeof settings[b[0]]!="undefined"&&b.length==2){settings[b[0]]=b[1]}}}if(settings.center==1){settings.top=(screen.height-(settings.height+110))/2;settings.left=(screen.width-settings.width)/2}parameters="location="+settings.location+",menubar="+settings.menubar+",height="+settings.height+",width="+settings.width+",toolbar="+settings.toolbar+",scrollbars="+settings.scrollbars+",status="+settings.status+",resizable="+settings.resizable+",left="+settings.left+",screenX="+settings.left+",top="+settings.top+",screenY="+settings.top;jQuery(this).bind("click",function(){var name=settings.createnew?"PopUpWindow"+index:"PopUpWindow";window.open(this.href,name,parameters).focus();return false})})};
//popup profiles
var profiles = { youtubewide: { height: 380, width: 593, center: 1, createnew: 0, status: 1 },welcome: { height: 380, width: 443, center: 1, createnew: 0, status: 1 },invitation: { height: 300, width: 475, center: 1, createnew: 0, status: 1 },audio: { height: 50, width: 250, center: 1, createnew: 0, status: 1 }, webinar: { height: 670, width: 820, center: 1, createnew: 0, status: 1 }, windowday: { height: 430, width: 780, center: 1, createnew: 0, status: 1 }, windowcallcenter: { height: 640, width: 980, center: 1, createnew: 0, status: 1 }, windowdemo: { height: 418, width: 624, center: 1, createnew: 0, status: 1 },windowtoolbar: { height: 560, width: 740, center: 1, createnew: 0, status: 1 },window800: { height: 800, width: 800, status: 1 }, window200: { height: 200, width: 200, status: 1, resizable: 0 }, windowCenter: { height: 300, width: 400, center: 1 }, windowNotNew: { height: 300, width: 400, center: 1, createnew: 0 }, windowemailcol: { height: 510, width: 400, center: 1, createnew: 0 }, windowprint: { height: 400, width: 600, center: 1, createnew: 0, scrollbars: 1}, newsletter: { height: 670, width: 405, center: 1, createnew: 0 }, windowprint: { height: 400, width: 600, center: 1, createnew: 0, scrollbars: 1} };

$().ready(function() {$('a[rel="external"]').click(function() {window.open($(this).attr('href')); return false})});


function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
document.write('<style type="text/css">#latest-carousel,#popular-carousel,#featured-carousel ul{display:none}</style>');
$(document).ready(function() {$('#latest-carousel, #popular-carousel,#featured-carousel ul').css('display','block');
    $('#latest-carousel').jcarousel({
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	$('div#popular-carousel ul').jcarousel({
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
    $('#featured-carousel').jcarousel({
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});

//side-tabs
$(document).ready(function() {
// setting the tabs in the sidebar hide and show, setting the current tab
	$('div.side-news-wrap div.side-news').hide();
	$('div.t1').show();
	$('div.side-news-wrap ul.tabs li.t1 a').addClass('tab-current');

// SIDEBAR TABS
$('div.side-news-wrap ul li a.tab').click(function(){
	var thisClass = this.className.slice(0,2);
	$('div.side-news-wrap div.side-news').hide();
	$('div.' + thisClass).show();
	$('div.side-news-wrap ul.tabs li a').removeClass('tab-current');
	$(this).addClass('tab-current');
	});
});

//home-tabs
$(document).ready(function() {
// setting the tabs in the homebar hide and show, setting the current tab
	$('div.home-news-wrap div.home-news').hide();
	$('div.h1').show();
	$('div.home-news-wrap ul.tabs li.h1 a').addClass('tab-current');

// homeBAR TABS
$('div.home-news-wrap ul li a.tab').click(function(){
	var thisClass = this.className.slice(0,2);
	$('div.home-news-wrap div.home-news').hide();
	$('div.' + thisClass).show();
	$('div.home-news-wrap ul.tabs li a').removeClass('tab-current');
	$(this).addClass('tab-current');
	});
});

$(function($) {		      
$(".popupwindow").popupwindow(profiles);
$('.crumbs a:first').addClass('first');
$('#top-nav ul.sf-menu').superfish({ delay: 100, animation: {opacity:'show'}, speed: 'fast', autoArrows: true, dropShadows: true }); 
$('#top-nav ul.sf-menu ul li:first-child').addClass('notop');
//search//
$("#search-bttn-wrap").hover( function() { 
$("#search-bttn",this).css("margin-top","-31px"); },
 function() { $("#search-bttn",this).css("margin-top","0"); });
var seek = "Search";
$(".search-field").val(seek); 
$(".search-field").css({color: "#aaaaaa"});
$(".search-field").focus(function(){
if($(this).val() == seek){
$(this).val("");
}
$(".search-field").css({color: "#000000"});
});
$(".search-field").blur(function(){
if($(this).val() == ("")){
$(this).val(seek);
}
$(".search-field").css({color: "#aaaaaa"});
});
});

//same page links
$(document).ready(function() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
$('a[href*=#]').each(function() {
var thisPath = filterPath(this.pathname) || locationPath;
if (locationPath == thisPath
&& (location.hostname == this.hostname || !this.hostname)
&& this.hash.replace(/#/,'') ) {
var $target = $(this.hash), target = this.hash;
if (target) {
var targetOffset = $target.offset().top;
$(this).click(function(event) {
event.preventDefault();
$('html, body').animate({scrollTop: targetOffset}, 400, function() {
location.hash = target;
});
});
}
}
});
});
