
jQuery.noConflict();

/* if IE run unitpngfix for sociable fade */
if(jQuery.browser.msie){
	var $shared_path = jQuery("meta[name=shared_path]").attr('content');
	var clear=$shared_path+"/clear.gif"; //path to clear.gif
	document.write('<script type="text/javascript" id="ct" defer="defer" src="javascript:void(0)"><\/script>');var ct=document.getElementById("ct");ct.onreadystatechange=function(){pngfix()};pngfix=function(){var els=document.getElementsByTagName('*'),ip=/\.png/i,al="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='",i=els.length,uels=new Array(),c=0;while(i-->0){if(els[i].className.match(/unitPng/)){uels[c]=els[i];c++;}}if(uels.length==0)pfx(els);else pfx(uels);function pfx(els){i=els.length;while(i-->0){var el=els[i],es=el.style,elc=el.currentStyle,elb=elc.backgroundImage;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter=al+el.src+"',sizingMethod='crop')";el.src=clear;}else{if(elb.match(ip)){var path=elb.split('"'),rep=(elc.backgroundRepeat=='no-repeat')?'crop':'scale',elkids=el.getElementsByTagName('*'),j=elkids.length;es.filter=al+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';if(j!=0){if(elc.position!="absolute")es.position='static';while(j-->0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}};};

}


/*______________________________________________________________________________________
Slider
___________________________________________________________*/

jQuery(document).ready(function () {

    var $slider_type = jQuery("meta[name=slider_type]").attr('content');
    var $slider_speed = jQuery("meta[name=slider_speed]").attr('content');
    var $slider_disable = jQuery("meta[name=slider_disable]").attr('content');

    if ($slider_type == 'fading') { $slider_img_class = "div[class^='single_fading_slide']"; $loadingID = '.fading_slides'; }
    if ($slider_type == 'tabbed') { $slider_img_class = "div[class^='single_tabbed_slide']"; $loadingID = '#tabbed_slides'; }

    if ($slider_disable == 'false') { $disable_slider = false; }
    if ($slider_disable == 'true') { $disable_slider = true; }


    /**
    * Slider Image Preloader
    * 
    */
    jQuery(function () {

        // grab the images
        var $slider_images = jQuery($slider_img_class + ' span img');

        // image length
        var $max_slides = $slider_images.length;

        // remove them from DOM to prevent normal load
        jQuery('.rm_slider_img').remove();

        // start loading
        if ($max_slides > 0) {
            LoadSliderImage(0, $max_slides);
        }

        // loading function handler
        function LoadSliderImage(index, $max_slides) {

            if (index < $max_slides) {

                // add list to div
                jQuery('<span id="slider_img' + (index + 1) + '"></span>').each(function () {
                    jQuery(this).appendTo(jQuery($loadingID + ' .load_slider_img').eq(index));
                });

                // new image object
                var $img = new Image();

                // current image
                var $curr = jQuery("#slider_img" + (index + 1));

                // load current image
                jQuery($img).load(function () {

                    // hide it first + .hide() failed in safari
                    jQuery(this).css('display', 'none');

                    //add alt attr
                    jQuery(this).attr({ alt: "" });

                    // remove loading class from div and insert the image into it
                    jQuery($curr).append(this);

                    // fade it in
                    jQuery(this).fadeIn(250, function () {

                        if (index == ($max_slides - 1)) {
                            // remove loading div after all images loaded then start slider
                            jQuery('#loading_slider').remove();

                            if ($slider_type == 'fading') { fadingStart(); }

                            if ($slider_type == 'tabbed') {
                                jQuery(".single_tabbed_slide").removeClass("noscript");
                                jQuery("#thumbs").removeClass("noscript");
                                tabbedStart();
                            }


                        } else {
                            // we are loading next item
                            LoadSliderImage(index + 1, $max_slides);
                        }
                    });

                }).error(function () {
                    // if loading error remove div
                    jQuery($curr).remove();
                    // try to load next item
                    LoadSliderImage(index + 1, $max_slides);
                }).attr('src', jQuery($slider_images[index]).attr('src')).attr('class', jQuery($slider_images[index]).attr('class'));
            }
        }
    });

    
    /**
    * jQuery Tools Slideshow
    * 
    */
    function fadingStart() {

        jQuery(".slidetabs,.pslidetabs").tabs(".fading_slides > div.single_fading_slide", {

            // enable "cross-fading" effect
            effect: 'fade',
            fadeOutSpeed: "slow",

            // start from the beginning after the last tab
            rotate: true,

            onBeforeClick: function (event, index) {
                var CurrentTab = this.getCurrentPane();
                CurrentTab.next().find('.slider_content').css('display', 'none');
                CurrentTab.find('.slider_content').css('display', 'none');
            },

            onClick: function (event, index) {
                var CurrentTab = this.getCurrentPane();
                CurrentTab.find('.slider_content').css('display', 'block');
            }


            // use the slideshow plugin. It accepts its own configuration
        }).slideshow({ clickable: false, autoplay: $disable_slider, interval: $slider_speed });

        jQuery('.fading_slides').css("display", "block");
    }

    /**
    * jQuery Tools Tabbed Slider
    * 
    */
    function tabbedStart() {

        // initialize scrollable and return the programming API
        jQuery("#webtreats_tabbed_slider").scrollable({

            items: '#tabbed_slides',
            size: 1,
            clickable: false,
            circular: true

            // use the navigator plugin
        }).autoscroll({ autoplay: $disable_slider, interval: $slider_speed }).navigator({ api: true });
    }

});

/**
* Create Album for gallery
*
*/

function createAlbum(container, w, ht, file) {

    var flashvars = {
        paramXMLPath: "../media/param_main.xml",
        wmode: "opaque",
        //initialURL: escape(document.location),
        xmlFilePath: "http://66.226.18.56/galleries/Campvictorylake/images.php?album=" + file + ""
    }
    var params = {
        base: ".",
        bgcolor: "#121212",
        allowfullscreen: "true"
    }
    var attributes = {}
	jQuery("#intro_blurb").slideUp();
    swfobject.embedSWF("media/slideshow.swf", "" + container + "", "" + w + "", "" + ht + "", "9.0.0", false, flashvars, params, attributes);
}


// Nivo slider
if (jQuery('#img_slider').length > 0) {
    jQuery("#img_slider").nivoSlider({ directionNav: true, pauseTime: 2000, captionOpacity: 0.5 });
}

/* delay function */
jQuery.fn.delay = function(time,func) {
	this.each(function() {
		setTimeout(func,time);
	})
	return this;
};

/* hover fade functions */
function fade_hover() {
	jQuery('.fade_hover').hover(
		function() {
				jQuery(this).stop().animate({opacity:0.4},400);
			},
			function() {
				jQuery(this).stop().animate({opacity:1},400);
		});

}

function portfolio_img_hover() {
	jQuery(".load_img").hover(
		function() {
				jQuery(this).find('.portfolio_hover').stop().animate({opacity:0.4},400);
			},
			function() {
				jQuery(this).find('.portfolio_hover').stop().animate({opacity:1},400);
			});
}

function sociable_hover() {
	jQuery('.sociable_hover').hover(
		function() {
				jQuery(this).stop().animate({opacity:0.5},400);
			},
			function() {
				jQuery(this).stop().animate({opacity:1},400);
		});
}

function button_hover(){
	jQuery('.button_link,button[type=submit],button,input[type=submit],input[type=button],input[type=reset]').hover(
		function() {
				jQuery(this).stop().animate({opacity:0.8},400);
			},
			function() {
				jQuery(this).stop().animate({opacity:1},400);
		});
}


function expandIt(getIt){getIt.style.display=(getIt.style.display=="none")?"":"none";}

/* 
 * No Spam (1.3)
 * by Mike Branski (www.leftrightdesigns.com)
 * mikebranski@gmail.com
 *
 * Copyright (c) 2008 Mike Branski (www.leftrightdesigns.com)
 * Licensed under GPL (www.leftrightdesigns.com/library/jquery/nospam/gpl.txt)
 *
 * NOTE: This script requires jQuery to work.  Download jQuery at www.jquery.com
 *
 * Thanks to Bill on the jQuery mailing list for the double slash idea!
 *
 * CHANGELOG:
 * v 1.3   - Added support for e-mail addresses with multiple dots (.) both before and after the at (@) sign
 * v 1.2.1 - Included GPL license
 * v 1.2   - Finalized name as No Spam (was Protect Email)
 * v 1.1   - Changed switch() to if() statement
 * v 1.0   - Initial release
 *
 */

jQuery.fn.nospam = function(settings) {
	settings = jQuery.extend({
		replaceText: false, 	// optional, accepts true or false
		filterLevel: 'normal' 	// optional, accepts 'low' or 'normal'
	}, settings);
	
	return this.each(function(){
		e = null;
		if(settings.filterLevel == 'low') { // Can be a switch() if more levels added
			if(jQuery(this).is('a[rel]')) {
				e = jQuery(this).attr('rel').replace('//', '@').replace(/\//g, '.');
			} else {
				e = jQuery(this).text().replace('//', '@').replace(/\//g, '.');
			}
		} else { // 'normal'
			if(jQuery(this).is('a[rel]')) {
				e = jQuery(this).attr('rel').split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			} else {
				e = jQuery(this).text().split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			}
		}
		if(e) {
			if(jQuery(this).is('a[rel]')) {
				jQuery(this).attr('href', 'mailto:' + e);
				if(settings.replaceText) {
					jQuery(this).text(e);
				}
			} else {
				jQuery(this).text(e);
			}
		}
	});
};

/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Update: April 12th, 10: Fixed compat issue with jquery 1.4x

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['', ''], right:['', '']}

var jqueryslidemenu={

animateduration: {over: 200, out: 25}, //duration of slide in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		$(" #main_navigation a").removeAttr("title");

		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			/*
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)*/
			
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					
					if(jQuery.browser.msie){
						var menuleft=this.istopheader? 0 : this._dimensions.w +2
						menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) -4 : menuleft
					}
					if(!jQuery.browser.msie){
						var menuleft=this.istopheader? 0 : this._dimensions.w
						menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					}
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
			$curobj.click(function(){
				$(this).children("ul:eq(0)").hide()
			})
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}
//build menu with ID="main_navigation" on page:
jqueryslidemenu.buildmenu("main_navigation", arrowimages)


jQuery(document).ready(function () {
    if (!jQuery.browser.msie) {
        button_hover()
        sociable_hover();
    } fade_hover();

    /* 
    * Cufon 
    */
    var $disable_cufon = jQuery("meta[name=disable_cufon]").attr('content');

    if ($disable_cufon != 'true') {

        Cufon.replace('h4,h5,#site_name,.dropcap1,.dropcap4,.teaser_large', {});
        Cufon.replace('#blurb,#footer_teaser_text', { textShadow: '#f9f9f9 1px 1px' });
        Cufon.replace('th,.light_gradient', {
            color: '-linear-gradient(#bbb, #888)',
            hover: 'true'
        });
        Cufon.replace('h3', {
            color: '-linear-gradient(#bbb, #888)'
        });
        Cufon.replace('h1,.staged_slide h2, .partial_staged_slide h2, .floating_slide h2, .full_slide h2, #body_block_background h2,.widgettitle,.dropcap2,.dark_gradient', {
            color: '-linear-gradient(#999, #4d4d4d)',
            hover: 'true',
            textShadow: '#fff 1px 1px'
        });
        Cufon.replace('.partial_gradient_slide h2', {});
        Cufon.replace('.large_button', { textShadow: '0 -1px 0 #888888' });

        Cufon.replace('.toggle_frame h4.toggle', { color: '-linear-gradient(#bbb, #888)', hover: 'false' });

        //fix flash of unstyled content with cufon
        jQuery('h1,h2,h3,h4,h5,#blurb,#site_name,.toggle,.light_gradient.dropcap1,.widgettitle,.dropcap2,.dropcap4,.teaser_large,.dark_gradient,th').each(function () {
            jQuery(this).css("text-indent", "0px");
        });

        var userAgent = navigator.userAgent.toLowerCase();
        if (jQuery.browser.msie) {
            var $ieVersion = jQuery.browser.version.substring(0, 1);
            if ($ieVersion == 7) {
                jQuery(".dropcap1").css({ paddingTop: "2px" });
            }
        }

    }



    /*
    * prettyPhoto 
    */
    jQuery("a[rel^='prettyPhoto'], a[rel^='lightbox']").prettyPhoto({
        overlay_gallery: false, "theme": 'light_rounded' /* light_square / dark_rounded / light_square / dark_square */
    });


    /* 
    * toggle functions 
    */
    //Hide (Collapse) the toggle containers on load
    jQuery(".toggle_content").hide();

    //Switch the "Open" and "Close" state per click
    jQuery("h4.toggle").toggle(function () {
        jQuery(this).addClass("active");
    }, function () {
        jQuery(this).removeClass("active");
    });

    //Slide up and down on click
    jQuery("h4.toggle").click(function () {
        jQuery(this).next(".toggle_content").slideToggle();
    });


    /* 
    * tooltip functions 
    */
    //sociable tooltip
    jQuery(".share_this_post").tooltip({ effect: 'slide', relative: false, tip: '.share_this_post_tooltip', offset: [20, 67] });

    //site search tooltip
    jQuery("#menu_search").tooltip({ effect: 'slide', relative: true, offset: [70, -45] });

    //tooltip shortcode
    jQuery(".tooltip_image_sc").tooltip({ effect: "slide", relative: true, offset: [-70, 0] });
    jQuery(".tooltip_sc").tooltip({ effect: "slide", relative: true });



    /* 
    * tab functions
    */
    jQuery(function () {
        jQuery("ul.tabs").tabs("> .tab_content");
    });

    jQuery(function () {
        jQuery(".minimal_tab_set ul.tabs").tabs("> .tab_content");
        jQuery(".framed_tab_set ul.tabs").tabs("> .tab_content");
    });


    /* 
    * "target_blank" links
    */
    jQuery(".flickr_badge_image a").attr("target", "_blank");
    jQuery(".target_blank").attr("target", "_blank");


    /* 
    * spam protction on mailto: links
    */
    jQuery('a.email').nospam({
        replaceText: false,
        filterLevel: 'normal'
    });

    jQuery('a.email_widget').nospam({
        replaceText: true,
        filterLevel: 'normal'
    });


    /* 
    * contact form widget
    */
    jQuery('form#contactFormWidget').submit(function () {

        // assign dynamic div height to footer
        var $h = jQuery(".footer_background").height();
        jQuery(".footer_background").css({ height: $h });

        // assign dynamic div height to secondary
        var $sb_h = jQuery("#secondary").height();
        jQuery("#secondary").css({ height: $sb_h });

        jQuery('form#contactFormWidget .error').remove();
        var hasError = false;
        jQuery('.requiredField').each(function () {
            if (jQuery.trim(jQuery(this).val()) == '') {
                var labelText = jQuery(this).prev('label').text();
                //jQuery(this).parent().append('<span class="error">You forgot to enter your '+labelText+'.</span>');
                jQuery(this).addClass('inputError');
                hasError = true;
            } else if (jQuery(this).hasClass('email')) {
                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                if (!emailReg.test(jQuery.trim(jQuery(this).val()))) {
                    var labelText = jQuery(this).prev('label').text();
                    //jQuery(this).parent().append('<span class="error">You entered an invalid '+labelText+'.</span>');
                    jQuery(this).addClass('inputError');
                    hasError = true;
                }
            }
        });

        if (!hasError) {

            jQuery("#submittedWidget").css('display', 'none');
            jQuery(".loadingImgWidget").fadeTo("slow", 0.5);

            var formInput = jQuery(this).serialize();
            jQuery.post(jQuery('#submitUrlWidget').val(), formInput, function (data) {
                jQuery('form#contactFormWidget').fadeOut('fast', function () {
                    jQuery(this).before('<p class="thanks"><strong>Thanks!</strong> Your email was successfully sent.</p>');
                });
            });
        }

        return false;

    });

    /* 
    * contact form
    */
    jQuery('form#contact_form').submit(function () {

        // assign dynamic div height to body_block
        var $h = jQuery("#main").height();
        jQuery("#main").css({ height: $h });

        jQuery('form#contact_form .error').remove();
        var hasError = false;
        jQuery('.requiredFieldContact').each(function () {
            if (jQuery.trim(jQuery(this).val()) == '') {
                var labelText = jQuery(this).prev('label').text();
                //jQuery(this).parent().append('<span class="error">You forgot to enter your '+labelText+'.</span>');
                jQuery(this).addClass('inputError');
                hasError = true;
            } else if (jQuery(this).hasClass('email')) {
                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                if (!emailReg.test(jQuery.trim(jQuery(this).val()))) {
                    var labelText = jQuery(this).prev('label').text();
                    //jQuery(this).parent().append('<span class="error">You entered an invalid '+labelText+'.</span>');
                    jQuery(this).addClass('inputError');
                    hasError = true;
                }
            }
        });

        if (!hasError) {

            jQuery("#submittedContact").css('display', 'none');
            jQuery(".loadingImg").css('display', 'block');

            var formInput = jQuery(this).serialize();
            jQuery.post(jQuery('#submitUrl').val(), formInput, function (data) {
                jQuery('form#contact_form').fadeOut('fast', function () {
                    jQuery(this).before('<p class="thanks"><strong>Thanks!</strong> Your email was successfully sent.</p>');
                });
            });
        }

        return false;

    });

    /* image preloader  */
    jQuery(function () {

        // class of the div containers
        var $imgContainerClass = ".img_loader";

        // grab the images
        var $images = jQuery($imgContainerClass + ' span img');

        // image length
        var $max = $images.length;

        // remove them from DOM to prevent normal load
        jQuery('.rm_img').remove();

        // start loading
        if ($max > 0) {
            LoadImage(0, $max);
        }

        // loading function handler
        function LoadImage(index, $max) {

            if (index < $max) {

                // add list to div
                jQuery('<span id="img' + (index + 1) + '"></span>').each(function () {
                    jQuery(this).appendTo(jQuery('.img_loader .load_img').eq(index));
                });

                // new image object
                var $img = new Image();

                // current image
                var $curr = jQuery("#img" + (index + 1));

                // load current image
                jQuery($img).load(function () {

                    // hide it first + .hide() failed in safari
                    jQuery(this).css('display', 'none');

                    //add alt attr
                    //jQuery(this).attr({alt: ""});

                    // remove loading class from div and insert the image into it
                    jQuery($curr).append(this);

                    // fade it in
                    jQuery(this).fadeIn('slow', function () {
                        jQuery(this).parent().parent().css("background-image", "none");

                        if (index == ($max - 1)) {
                            jQuery('div, li').removeClass('bg_hover');
                            portfolio_img_hover();
                            fade_hover();

                        } else {
                            // we are loading next item
                            LoadImage(index + 1, $max);
                        }
                    });

                }).error(function () {
                    // if loading error remove div
                    jQuery($curr).remove();
                    // try to load next item
                    LoadImage(index + 1, $max);
                }).attr('src', jQuery($images[index]).attr('src')).attr('class', jQuery($images[index]).attr('class'));
            }
        }
    });

});


/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend(jQuery.easing,
{
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        //alert(jQuery.easing.default);
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
    },
    easeInQuad: function (x, t, b, c, d) {
        return c * (t /= d) * t + b;
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c * (t /= d) * (t - 2) + b;
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t + b;
        return -c / 2 * ((--t) * (t - 2) - 1) + b;
    },
    easeInCubic: function (x, t, b, c, d) {
        return c * (t /= d) * t * t + b;
    },
    easeOutCubic: function (x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t + 1) + b;
    },
    easeInOutCubic: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t + 2) + b;
    },
    easeInQuart: function (x, t, b, c, d) {
        return c * (t /= d) * t * t * t + b;
    },
    easeOutQuart: function (x, t, b, c, d) {
        return -c * ((t = t / d - 1) * t * t * t - 1) + b;
    },
    easeInOutQuart: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
        return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
    },
    easeInQuint: function (x, t, b, c, d) {
        return c * (t /= d) * t * t * t * t + b;
    },
    easeOutQuint: function (x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
    },
    easeInOutQuint: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
    },
    easeInSine: function (x, t, b, c, d) {
        return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
    },
    easeOutSine: function (x, t, b, c, d) {
        return c * Math.sin(t / d * (Math.PI / 2)) + b;
    },
    easeInOutSine: function (x, t, b, c, d) {
        return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
    },
    easeInExpo: function (x, t, b, c, d) {
        return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
    },
    easeOutExpo: function (x, t, b, c, d) {
        return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
    },
    easeInOutExpo: function (x, t, b, c, d) {
        if (t == 0) return b;
        if (t == d) return b + c;
        if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
        return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
    },
    easeInCirc: function (x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
    },
    easeOutCirc: function (x, t, b, c, d) {
        return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
    },
    easeInOutCirc: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
        return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
    },
    easeInElastic: function (x, t, b, c, d) {
        var s = 1.70158; var p = 0; var a = c;
        if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3;
        if (a < Math.abs(c)) { a = c; var s = p / 4; }
        else var s = p / (2 * Math.PI) * Math.asin(c / a);
        return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
    },
    easeOutElastic: function (x, t, b, c, d) {
        var s = 1.70158; var p = 0; var a = c;
        if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3;
        if (a < Math.abs(c)) { a = c; var s = p / 4; }
        else var s = p / (2 * Math.PI) * Math.asin(c / a);
        return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
    },
    easeInOutElastic: function (x, t, b, c, d) {
        var s = 1.70158; var p = 0; var a = c;
        if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d * (.3 * 1.5);
        if (a < Math.abs(c)) { a = c; var s = p / 4; }
        else var s = p / (2 * Math.PI) * Math.asin(c / a);
        if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
        return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
    },
    easeInBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c * (t /= d) * t * ((s + 1) * t - s) + b;
    },
    easeOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
    },
    easeInOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
        return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
    },
    easeInBounce: function (x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b;
    },
    easeOutBounce: function (x, t, b, c, d) {
        if ((t /= d) < (1 / 2.75)) {
            return c * (7.5625 * t * t) + b;
        } else if (t < (2 / 2.75)) {
            return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
        } else if (t < (2.5 / 2.75)) {
            return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
        } else {
            return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
        }
    },
    easeInOutBounce: function (x, t, b, c, d) {
        if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b;
    }
});


/**
* jqFancyTransitions - jQuery plugin
* @version: 1.0 (2009/12/04)
* @requires jQuery v1.2.2 or later 
* @author Ivan Lazarevic
* Examples and documentation at: http://www.workshop.rs/projects/jqfancytransitions
 
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
**/

(function ($) {
    var opts = new Array; var level = new Array; var img = new Array; var titles = new Array; var order = new Array; var imgInc = new Array; var inc = new Array; var stripInt = new Array; var imgInt = new Array; $.fn.jqFancyTransitions = $.fn.jqFancyTransitions = function (options) {
        init = function (el) {
            opts[el.id] = $.extend({}, $.fn.jqFancyTransitions.defaults, options); img[el.id] = new Array(); titles[el.id] = new Array(); order[el.id] = new Array(); imgInc[el.id] = 0; inc[el.id] = 0; params = opts[el.id]; if (params.effect == 'zipper') { params.direction = 'alternate'; params.position = 'alternate'; }
            if (params.effect == 'wave') { params.direction = 'alternate'; params.position = 'top'; }
            if (params.effect == 'curtain') { params.direction = 'alternate'; params.position = 'curtain'; }
            stripWidth = parseInt(params.width / params.strips); gap = params.width - stripWidth * params.strips; stripLeft = 0; $.each($('#' + el.id + ' img'), function (i, item) { img[el.id][i] = $(item).attr('src'); titles[el.id][i] = $(item).attr('alt') ? $(item).attr('alt') : ''; $(item).hide(); }); $('#' + el.id).css({ 'background-image': 'url(' + img[el.id][0] + ')', 'width': params.width, 'height': params.height, 'position': 'relative', 'background-position': 'top left' }); $('#' + el.id).append("<div class='ft-title' id='ft-title-" + el.id + "' style='position: absolute; bottom:0; left: 0; z-index: 1000; color: #fff; background-color: #000; '>" + titles[el.id][0] + "</div>"); if (titles[el.id][imgInc[el.id]])
                $('#ft-title-' + el.id).css('opacity', opts[el.id].titleOpacity); else
                $('#ft-title-' + el.id).css('opacity', 0); odd = 1; for (j = 1; j < params.strips + 1; j++) {
                if (gap > 0) { tstripWidth = stripWidth + 1; gap--; } else { tstripWidth = stripWidth; }
                $('#' + el.id).append("<div class='ft-" + el.id + "' id='ft-" + el.id + j + "' style='width:" + tstripWidth + "px; height:" + params.height + "px; float: left; position: absolute;'></div>"); $("#ft-" + el.id + j).css({ 'background-position': -stripLeft + 'px top', 'left': stripLeft }); stripLeft += tstripWidth; if (params.position == 'bottom')
                    $("#ft-" + el.id + j).css('bottom', 0); if (j % 2 == 0 && params.position == 'alternate')
                    $("#ft-" + el.id + j).css('bottom', 0); if (params.direction == 'fountain' || params.direction == 'fountainAlternate') { order[el.id][j - 1] = parseInt(params.strips / 2) - (parseInt(j / 2) * odd); order[el.id][params.strips - 1] = params.strips; odd *= -1; } else { order[el.id][j - 1] = j; } 
            }
            $('.ft-' + el.id).mouseover(function () { opts[el.id].pause = true; }); $('.ft-' + el.id).mouseout(function () { opts[el.id].pause = false; }); $('#ft-title-' + el.id).mouseover(function () { opts[el.id].pause = true; }); $('#ft-title-' + el.id).mouseout(function () { opts[el.id].pause = false; }); clearInterval(imgInt[el.id]); imgInt[el.id] = setInterval(function () { $.transition(el) }, params.delay + params.stripDelay * params.strips);
        }; $.transition = function (el) {
            if (opts[el.id].pause == true) return; stripInt[el.id] = setInterval(function () { $.strips(order[el.id][inc[el.id]], el) }, opts[el.id].stripDelay); $('#' + el.id).css({ 'background-image': 'url(' + img[el.id][imgInc[el.id]] + ')' }); imgInc[el.id]++; if (imgInc[el.id] == img[el.id].length) { imgInc[el.id] = 0; }
            if (titles[el.id][imgInc[el.id]] != '') { $('#ft-title-' + el.id).animate({ opacity: 0 }, opts[el.id].titleSpeed, function () { $(this).html(titles[el.id][imgInc[el.id]]).animate({ opacity: opts[el.id].titleOpacity }, opts[el.id].titleSpeed); }); } else { $('#ft-title-' + el.id).animate({ opacity: 0 }, opts[el.id].titleSpeed); }
            inc[el.id] = 0; if (opts[el.id].direction == 'random')
                $.fisherYates(order[el.id]); if ((opts[el.id].direction == 'right' && order[el.id][0] == 1) || opts[el.id].direction == 'alternate' || opts[el.id].direction == 'fountainAlternate')
                order[el.id].reverse();
        }; $.strips = function (itemId, el) {
            temp = opts[el.id].strips; if (inc[el.id] == temp) { clearInterval(stripInt[el.id]); return; }
            if (opts[el.id].position == 'curtain') { currWidth = $('#ft-' + el.id + itemId).width(); $('#ft-' + el.id + itemId).css({ width: 0, opacity: 0, 'background-image': 'url(' + img[el.id][imgInc[el.id]] + ')' }); $('#ft-' + el.id + itemId).animate({ width: currWidth, opacity: 1 }, 1000); } else { $('#ft-' + el.id + itemId).css({ height: 0, opacity: 0, 'background-image': 'url(' + img[el.id][imgInc[el.id]] + ')' }); $('#ft-' + el.id + itemId).animate({ height: opts[el.id].height, opacity: 1 }, 1000); }
            inc[el.id]++;
        }; $.fisherYates = function (arr) { var i = arr.length; if (i == 0) return false; while (--i) { var j = Math.floor(Math.random() * (i + 1)); var tempi = arr[i]; var tempj = arr[j]; arr[i] = tempj; arr[j] = tempi; } }
        this.each(function () { init(this); });
    }; $.fn.jqFancyTransitions.defaults = { width: 500, height: 332, strips: 20, delay: 5000, stripDelay: 50, titleOpacity: 0.7, titleSpeed: 1000, position: 'alternate', direction: 'fountainAlternate', effect: '' };
})(jQuery);





/*
* jQuery Nivo Slider v2.0
* http://nivo.dev7studios.com
*
* Copyright 2010, Gilbert Pellegrom
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 
* May 2010 - Pick random effect from specified set of effects by toronegro
* May 2010 - controlNavThumbsFromRel option added by nerd-sh
* May 2010 - Do not start nivoRun timer if there is only 1 slide by msielski
* April 2010 - controlNavThumbs option added by Jamie Thompson (http://jamiethompson.co.uk)
* March 2010 - manualAdvance option added by HelloPablo (http://hellopablo.co.uk)
*/

eval(function (p, a, c, k, e, d) { e = function (c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) { d[e(c)] = k[c] || e(c) } k = [function (e) { return d[e] } ]; e = function () { return '\\w+' }; c = 1 }; while (c--) { if (k[c]) { p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]) } } return p } ('(9($){$.1f.1q=9(1X){b 3=$.2i({},$.1f.1q.2c,1X);I g.E(9(){b 4={f:0,t:\'\',U:0,o:\'\',N:m,1k:m,1N:m};b 5=$(g);5.1S(\'7:4\',4);5.e(\'2h\',\'2g\');5.1n(\'1q\');b d=5.2j();d.E(9(){b j=$(g);b 1p=\'\';6(!j.K(\'B\')){6(j.K(\'a\')){j.1n(\'7-2k\');1p=j}j=j.1g(\'B:1s\')}b 1c=j.w();6(1c==0)1c=j.s(\'w\');b 1d=j.x();6(1d==0)1d=j.s(\'x\');6(1c>5.w()){5.w(1c)}6(1d>5.x()){5.x(1d)}6(1p!=\'\'){1p.e(\'P\',\'1h\')}j.e(\'P\',\'1h\');4.U++});6(3.1a>0){6(3.1a>=4.U)3.1a=4.U-1;4.f=3.1a}6($(d[4.f]).K(\'B\')){4.t=$(d[4.f])}n{4.t=$(d[4.f]).1g(\'B:1s\')}6($(d[4.f]).K(\'a\')){$(d[4.f]).e(\'P\',\'1w\')}5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\');2b(b i=0;i<3.h;i++){b G=X.27(5.w()/3.h);6(i==3.h-1){5.J($(\'<C z="7-c"></C>\').e({21:(G*i)+\'13\',w:(5.w()-(G*i))+\'13\'}))}n{5.J($(\'<C z="7-c"></C>\').e({21:(G*i)+\'13\',w:G+\'13\'}))}}5.J($(\'<C z="7-H"><p></p></C>\').e({P:\'1h\',y:3.1Y}));6(4.t.s(\'16\')!=\'\'){$(\'.7-H p\',5).1y(4.t.s(\'16\'));$(\'.7-H\',5).1x(3.q)}b l=0;6(!3.1i&&d.1j>1){l=1v(9(){F(5,d,3,m)},3.1m)}6(3.T){5.J(\'<C z="7-T"><a z="7-2a">2f</a><a z="7-29">2m</a></C>\');6(3.2d){$(\'.7-T\',5).24();5.25(9(){$(\'.7-T\',5).2l()},9(){$(\'.7-T\',5).24()})}$(\'a.7-2a\',5).1J(\'1I\',9(){6(4.N)I m;S(l);l=\'\';4.f-=2;F(5,d,3,\'1C\')});$(\'a.7-29\',5).1J(\'1I\',9(){6(4.N)I m;S(l);l=\'\';F(5,d,3,\'1A\')})}6(3.M){b 1b=$(\'<C z="7-M"></C>\');5.J(1b);2b(b i=0;i<d.1j;i++){6(3.20){b j=d.1B(i);6(!j.K(\'B\')){j=j.1g(\'B:1s\')}6(3.1Q){1b.J(\'<a z="7-1l" 11="\'+i+\'"><B D="\'+j.s(\'11\')+\'" 28="" /></a>\')}n{1b.J(\'<a z="7-1l" 11="\'+i+\'"><B D="\'+j.s(\'D\').2n(3.1R,3.1P)+\'" 28="" /></a>\')}}n{1b.J(\'<a z="7-1l" 11="\'+i+\'">\'+i+\'</a>\')}}$(\'.7-M a:1B(\'+4.f+\')\',5).1n(\'1o\');$(\'.7-M a\',5).1J(\'1I\',9(){6(4.N)I m;6($(g).2e(\'1o\'))I m;S(l);l=\'\';5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\');4.f=$(g).s(\'11\')-1;F(5,d,3,\'1l\')})}6(3.1M){$(2q).2A(9(1L){6(1L.1Z==\'2C\'){6(4.N)I m;S(l);l=\'\';4.f-=2;F(5,d,3,\'1C\')}6(1L.1Z==\'2D\'){6(4.N)I m;S(l);l=\'\';F(5,d,3,\'1A\')}})}6(3.1T){5.25(9(){4.1k=Q;S(l);l=\'\'},9(){4.1k=m;6(l==\'\'&&!3.1i){l=1v(9(){F(5,d,3,m)},3.1m)}})}5.2E(\'7:Z\',9(){4.N=m;$(d).E(9(){6($(g).K(\'a\')){$(g).e(\'P\',\'1h\')}});6($(d[4.f]).K(\'a\')){$(d[4.f]).e(\'P\',\'1w\')}6(l==\'\'&&!4.1k&&!3.1i){l=1v(9(){F(5,d,3,m)},3.1m)}3.1U.1z(g)})});9 F(5,d,3,19){b 4=5.1S(\'7:4\');6((!4||4.1N)&&!19)I m;3.1W.1z(g);6(!19){5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\')}n{6(19==\'1C\'){5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\')}6(19==\'1A\'){5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\')}}4.f++;6(4.f==4.U){4.f=0;3.1V.1z(g)}6(4.f<0)4.f=(4.U-1);6($(d[4.f]).K(\'B\')){4.t=$(d[4.f])}n{4.t=$(d[4.f]).1g(\'B:1s\')}6(3.M){$(\'.7-M a\',5).2F(\'1o\');$(\'.7-M a:1B(\'+4.f+\')\',5).1n(\'1o\')}6(4.t.s(\'16\')!=\'\'){6($(\'.7-H\',5).e(\'P\')==\'1w\'){$(\'.7-H p\',5).22(3.q,9(){$(g).1y(4.t.s(\'16\'));$(g).1x(3.q)})}n{$(\'.7-H p\',5).1y(4.t.s(\'16\'))}$(\'.7-H\',5).1x(3.q)}n{$(\'.7-H\',5).22(3.q)}b i=0;$(\'.7-c\',5).E(9(){b G=X.27(5.w()/3.h);$(g).e({x:\'O\',y:\'0\',W:\'V(\'+4.t.s(\'D\')+\') R-Y -\'+((G+(i*G))-G)+\'13 0%\'});i++});6(3.k==\'1t\'){b 10=2G 2B("1K","14","1F","17","1E","12","1D","1r");4.o=10[X.26(X.1t()*(10.1j+1))];6(4.o==2y)4.o=\'1r\'}6(3.k.2o(\',\')!=-1){b 10=3.k.2r(\',\');4.o=$.2z(10[X.26(X.1t()*10.1j)])}4.N=Q;6(3.k==\'2p\'||3.k==\'1K\'||4.o==\'1K\'||3.k==\'14\'||4.o==\'14\'){b u=0;b i=0;b h=$(\'.7-c\',5);6(3.k==\'14\'||4.o==\'14\')h=$(\'.7-c\',5).1e();h.E(9(){b c=$(g);c.e(\'1G\',\'O\');6(i==3.h-1){L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q)},(r+u))}u+=1u;i++})}n 6(3.k==\'2t\'||3.k==\'1F\'||4.o==\'1F\'||3.k==\'17\'||4.o==\'17\'){b u=0;b i=0;b h=$(\'.7-c\',5);6(3.k==\'17\'||4.o==\'17\')h=$(\'.7-c\',5).1e();h.E(9(){b c=$(g);c.e(\'23\',\'O\');6(i==3.h-1){L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q)},(r+u))}u+=1u;i++})}n 6(3.k==\'1E\'||3.k==\'2u\'||4.o==\'1E\'||3.k==\'12\'||4.o==\'12\'){b u=0;b i=0;b v=0;b h=$(\'.7-c\',5);6(3.k==\'12\'||4.o==\'12\')h=$(\'.7-c\',5).1e();h.E(9(){b c=$(g);6(i==0){c.e(\'1G\',\'O\');i++}n{c.e(\'23\',\'O\');i=0}6(v==3.h-1){L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q)},(r+u))}u+=1u;v++})}n 6(3.k==\'1D\'||4.o==\'1D\'){b u=0;b i=0;$(\'.7-c\',5).E(9(){b c=$(g);b 1H=c.w();c.e({1G:\'O\',x:\'r%\',w:\'O\'});6(i==3.h-1){L(9(){c.A({w:1H,y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({w:1H,y:\'1.0\'},3.q)},(r+u))}u+=1u;i++})}n 6(3.k==\'1r\'||4.o==\'1r\'){b i=0;$(\'.7-c\',5).E(9(){$(g).e(\'x\',\'r%\');6(i==3.h-1){$(g).A({y:\'1.0\'},(3.q*2),\'\',9(){5.18(\'7:Z\')})}n{$(g).A({y:\'1.0\'},(3.q*2))}i++})}}};$.1f.1q.2c={k:\'1t\',h:15,q:2x,1m:2w,1a:0,T:Q,2d:Q,M:Q,20:m,1Q:m,1R:\'.1O\',1P:\'2v.1O\',1M:Q,1T:Q,1i:m,1Y:0.8,1W:9(){},1U:9(){},1V:9(){}};$.1f.1e=[].1e})(2s);', 62, 167, '|||settings|vars|slider|if|nivo||function||var|slice|kids|css|currentSlide|this|slices||child|effect|timer|false|else|randAnim||animSpeed|100|attr|currentImage|timeBuff||width|height|opacity|class|animate|img|div|src|each|nivoRun|sliceWidth|caption|return|append|is|setTimeout|controlNav|running|0px|display|true|no|clearInterval|directionNav|totalSlides|url|background|Math|repeat|animFinished|anims|rel|sliceUpDownLeft|px|sliceDownLeft||title|sliceUpLeft|trigger|nudge|startSlide|nivoControl|childWidth|childHeight|reverse|fn|find|none|manualAdvance|length|paused|control|pauseTime|addClass|active|link|nivoSlider|fade|first|random|50|setInterval|block|fadeIn|html|call|next|eq|prev|fold|sliceUpDown|sliceUpRight|top|origWidth|click|live|sliceDownRight|event|keyboardNav|stop|jpg|controlNavThumbsReplace|controlNavThumbsFromRel|controlNavThumbsSearch|data|pauseOnHover|afterChange|slideshowEnd|beforeChange|options|captionOpacity|keyCode|controlNavThumbs|left|fadeOut|bottom|hide|hover|floor|round|alt|nextNav|prevNav|for|defaults|directionNavHide|hasClass|Prev|relative|position|extend|children|imageLink|show|Next|replace|indexOf|sliceDown|window|split|jQuery|sliceUp|sliceUpDownRight|_thumb|3000|500|undefined|trim|keypress|Array|37|39|bind|removeClass|new'.split('|'), 0, {}))

// qTip - CSS Tool Tips - by Craig Erskine
// http://qrayg.com
//
// Multi-tag support by James Crooke
// http://www.cj-design.com
//
// Inspired by code from Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com
//
// Copyright (c) 2006 Craig Erskine
// Permission is granted to copy, distribute and/or modify this document
// under the terms of the GNU Free Documentation License, Version 1.3
// or any later version published by the Free Software Foundation;
// with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
// A copy of the license is included in the section entitled "GNU
// Free Documentation License".

var wptdb_qTipTag = "a"; //Which tag do you want to qTip-ize? Keep it lowercase!//
var wptdb_qTipX = 0; //This is qTip's X offset//
var wptdb_qTipY = 15; //This is qTip's Y offset//
var wptdb_tooltip_at_btm = false;

//There's No need to edit anything below this line//
wptdb_tooltip = {
    name: "wptdb_qTip",
    offsetX: wptdb_qTipX,
    offsetY: wptdb_qTipY,
    tip: null
}

wptdb_tooltip.init = function () {
    var tipNameSpaceURI = "http://www.w3.org/1999/xhtml";
    if (!tipContainerID) { var tipContainerID = "wptdb_qTip"; }
    var tipContainer = document.getElementById(tipContainerID);

    if (!tipContainer) {
        tipContainer = document.createElementNS ? document.createElementNS(tipNameSpaceURI, "div") : document.createElement("div");
        tipContainer.setAttribute("id", tipContainerID);
        document.getElementsByTagName("body").item(0).appendChild(tipContainer);
    }

    if (!document.getElementById) return;
    this.tip = document.getElementById(this.name);
    if (this.tip) document.onmousemove = function (evt) { wptdb_tooltip.move(evt) };

    var a, sTitle, elements;

    var elementList = wptdb_qTipTag.split(",");
    for (var j = 0; j < elementList.length; j++) {
        elements = document.getElementsByTagName(elementList[j]);
        if (elements) {
            for (var i = 0; i < elements.length; i++) {
                a = elements[i];
                sTitle = a.getAttribute("title");
                sClassName = a.className;
                if (sTitle && sClassName == 'wptdb_qtip') {
                    a.setAttribute("tiptitle", sTitle);
                    a.removeAttribute("title");
                    a.removeAttribute("alt");
                    a.onmouseover = function () { wptdb_tooltip.show(this.getAttribute('tiptitle')) };
                    a.onmouseout = function () { wptdb_tooltip.hide() };
                }
            }
        }
    }

    try {
        var wptdb_get_demobar_pos = document.getElementById('wpthemedemobar_pos_teller').innerHTML;
        if (wptdb_get_demobar_pos == 'bottom') {
            wptdb_tooltip_at_btm = true;
        }
    } catch (e) { }

}

wptdb_tooltip.move = function (evt) {
    var x = 0, y = 0;
    if (document.all) {//IE
        x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
        y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
        x += window.event.clientX;
        y += window.event.clientY;

    } else {//Good Browsers
        x = evt.pageX;
        y = evt.pageY;
    }
    this.tip.style.left = (x + this.offsetX) + "px";
    if (!wptdb_tooltip_at_btm) {
        this.tip.style.top = (y + this.offsetY) + "px";
    } else {
        this.tip.style.top = (y - 17 - this.offsetY) + "px";
    }
}

wptdb_tooltip.show = function (text) {
    if (!this.tip) return;
    this.tip.innerHTML = text;
    this.tip.style.display = "block";
}

wptdb_tooltip.hide = function () {
    if (!this.tip) return;
    this.tip.innerHTML = "";
    this.tip.style.display = "none";
}

function wptdb_qtip_addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function () {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function wptdb_qtip_init() {
    wptdb_tooltip.init();
}

wptdb_qtip_addLoadEvent(wptdb_qtip_init);

/***
*
* Comments Form
*
***/

addComment = { moveForm: function (d, f, i, c) { var m = this, a, h = m.I(d), b = m.I(i), l = m.I("cancel-comment-reply-link"), j = m.I("comment_parent"), k = m.I("comment_post_ID"); if (!h || !b || !l || !j) { return } m.respondId = i; c = c || false; if (!m.I("wp-temp-form-div")) { a = document.createElement("div"); a.id = "wp-temp-form-div"; a.style.display = "none"; b.parentNode.insertBefore(a, b) } h.parentNode.insertBefore(b, h.nextSibling); if (k && c) { k.value = c } j.value = f; l.style.display = ""; l.onclick = function () { var n = addComment, e = n.I("wp-temp-form-div"), o = n.I(n.respondId); if (!e || !o) { return } n.I("comment_parent").value = "0"; e.parentNode.insertBefore(o, e); e.parentNode.removeChild(e); this.style.display = "none"; this.onclick = null; return false }; try { m.I("comment").focus() } catch (g) { } return false }, I: function (a) { return document.getElementById(a) } };