$(document).ready(function () {
	//=================================OPBOUW VAN DIT BESTAND============================================
	//Met de functies in dit bestand kunnen de standaard-elementen van de magnet worden opgeleukt.
	//Standaard staan deze functies aan en kunnen elementen hiervan gewijzigd worden.
	//Achter elke optie (of boven de functie) staat in het commentaar (zoals dit) beschreven wat je kunt wijzigen
	//Erboven staat ook hoe je de functies helemaal uit kunt zetten.
	//Daarna staat waar je eventueel de stylesheets moet/mag aanpassen

	//======================================ALGEMENE SETTINGS============================================
	var popwidth = 700; //standaard breedte van de lightbox
	var popheight = 600; //standaard hoogte van de lightbox
	var VautoDimensions = true; //zet op true als lightbox zelf de afmetingen moet detecteren. Anders false

	//======================================NAVIGATIEMENU============================================
	//uitzetten? Verander dan hier de classname van supermenu naar bv. 'supermenuoff'
	//in de standaard stylesheet (domein.css) staan alle .supermenu styles
	supermenu(
		  'supermenu', //1: de class van de div om  de navigatie-ul
		  'h', //2: h voor horizontaal menu / v voor verticaal menu
		  '100', //3: breedte van het menu in het geval van een verticaal menu
		  'fade1', //4: fade1 om te faden / anders fade0
		  'slide0', //5: slide1 om te sliden / anders slide0
		  'fast', //6: snelheid van de animatie. Dit kan 'slow','medium','fast' zijn of een getal in milliseconden
		  500, //7: delay. De duur dat het submenu blijft staan wanneer je muis er vanaf is in milliseconden
		  'arrows0'//8: arrows1 om pijltjes bij menuitems met submenu's te laten zien. Anders arrows0
		  );

	//======================================TAALKEUZEMENU============================================
	//uitzetten? Verander dan hier de classname van 'languagemenu' naar bv. 'languagemenuoff'
	//1: de classname van het taalmenu
	//2: delay. De duur dat het submenu blijft staan wanneer je muis er vanaf is in milliseconden
	//3: fade of slide
	languagemenu('languagemenu', 300, 'fade');

	//======================================FOTOALBUM============================================
	//uitzetten kan door voor de volgende regels een dubbele slash (zoals deze regel) te zetten.
	//stylesheet om aan te passen galleriffic-2.css
	myGallery(
		  18, 			//1: het aantal thumbnail tonen per pagina
		  false, 		//2: navigatie boven thumbnails aan
		  true, 		//3: navigatie onder thumbnails aan
		  false, 		//4: toon div class='nav-controls' met volgende/vorige links
		  false,  		//5: start als slideshow
		  7000, 		//6: duratie tussen foto's in slideshow
		  true, 		//7: Opent klikken op de grote foto de originele foto in een lightbox?
		  'elastic', //8: Hoe opent de lightbox. Opties: 'elastic','fade' of 'none'
		  500, 		//9: Hoe lang duurt voorgaand effect in milliseconden
		  true			//10: Toon de titel onder de foto
		  );

	//======================================LINKS IN LIGHTBOX OPENEN============================================
	//uitzetten kan door voor de volgende regel een dubbele slash (zoals deze regel) te zetten.
	//1: De tag waarnaar wordt gekeken. Dit kan een id, class, of iets zelfverzonnens zijn.
	//2: De waarde van de bovenstaande tag.
	//Wanneer dus linklb('title','popup') hieronder staat worden alle links met de volgende tag in een lightbox
	//geopend: title='popup'
	linklb('title', 'popup');

	//======================================PNG FIX============================================
	//uitzetten kan door voor de volgende regel een dubbele slash (zoals deze regel) te zetten.
	//$(function () { $(document).pngFix(); });


	//=========================================================================================
	//=============================HIERONDER NIKS AANPASSEN!!!!================================

	//frontbanner
	var numpics = $('#rotatorWrap div').size() - 1;
	numpics = numpics * 1;
	for (i = 0; i <= numpics; i = i + 1) {
		$('.rotatorcontrols').append('<a class="rotatorButtons" href="#' + (i + 1) + '">' + (i + 1) + '</a>');
	}
	
	$('.rotatorButtons').click(function (index) {
		clearTimeout(mytimer);
		var tmp = ($(this).index() * 1) + 1;
		$('#rotatorWrap div').removeClass('active').removeClass('last-active');
		$('#rotatorWrap div:nth-child(' + tmp + ')').addClass('active');
		$('.rotatorcontrols a').removeClass('current');
		$('.rotatorcontrols a:nth-child(' + tmp + ')').addClass('current');
		$('#frontpagerotator').addClass('go');
		return false;
	});


	$('.go').live('mouseleave', function () {
		$(this).removeClass('go');
		$('#rotatorWrap div').removeClass('active');
		$('#rotatorWrap div').removeClass('last-active')
		$('.rotatorcontrols a').removeClass('current');
		$('#rotatorWrap div:nth-child(' + (numpics + 1) + ')').addClass('last-active');
		slideSwitch(5000);
		mytimer = setInterval('slideSwitch(5000)', 5000);
	});



	var mytimer;
	slideSwitch(5000);
	$(function () {
		mytimer = setInterval('slideSwitch(5000)', 5000);
	});

	$(window).load(function () {

		//FLASHBANNER
		//if ($("#flashheader fh_products li").size() > 0) {
			$("#flashheader").jCarouselLite({
			auto: 2000,
			speed: 1000,
			visible: 7,
			circular: true
		});
		//}

		//detailpage lightbox
		vThumbs = $('.articleasset_small').size();
		var thImgs = [];
		$('.articleasset_small a img').each(function (i, selected) {
			thImgs[i] = $(this).attr('src');
		});
		$(thImgs).each(function (index) {
			if (index > 0) {
				$('.detail_img_main').append('<a href="' + thImgs[index].replace('icon', 'large') + '" rel="group1" style="display:none;" class="lightbox">&nbsp;</a>');
			}
		});
		//var startIndex = $('.detail_img_main a').attr('number')-1;
		if ($('.detail_img_main a').length > 0) {
		var tmp1 = $('.detail_img_main a').attr('title');
		$('.lightbox').fancybox({
			'autoDimensions': true,
			'transitionIn': 'fade',
			'transitionOut': 'fade',
			'speedIn': 500,
			'speedOut': 500,
			'overlayShow': true,
			'hideOnContentClick': false,
			'overlayOpacity': 0.65,
			'overlayColor': '#000000',
			'showNavArrows': true,
			'titleShow': true,
			'title': tmp1
		});
		$('.detail_img_main a').bind('click', function () {
			var startIndex = $('.detail_img_main a').attr('number') - 1;
			if (startIndex > 0) {
				setTimeout('$.fancybox.pos(' + startIndex + ');', 600);
			}
		});
		}



		//detailpage lightbox einde

	});
//FLASHBANNER images
	$('#fh_products li a img').hover(function (e) {
		$('.rotatorButtons').hide()
		var tmp = $(this).offset();
		$('#wrapper').prepend('<div id="fh_popup" style="z-index:999;"><img style="z-index:999;" src="' + $(this).attr('src').replace('icon', 'normal') + '" border="0"></div>');
		$('#fh_popup').fadeIn().css({ 'left': e.pageX - 133, 'top': e.pageY + 40 });
	}, function (e) {
		$('.rotatorButtons').show()
		$('#fh_popup').remove();
	});
	$(document).mousemove(function (e) {
		$('#fh_popup').css({ 'left': e.pageX - 133, 'top': e.pageY + 40 });
	});



	function linklb(v1, v2) {
		$('a[' + v1 + '="' + v2 + '"]').each(function () {
			var vurl = $(this).attr('href');
			var pathname = window.location.host;
			$(this).attr('id', '#actpop-' + $(this).index()).attr('href', '#pop-' + $(this).index()).after('<div style="display:none"><div class="popup" id="pop-' + $(this).index() + '"></div></div>');
			$('#pop-' + $(this).index() + ' #mainContent').remove();
			if (vurl.indexOf(pathname) >= 0) {
				$('#pop-' + $(this).index()).load(vurl + ' #mainContent');
			} else {
				$(this).attr({ 'href': vurl, 'class': 'iframe' });
			}
			$(this).fancybox({
				'width': popwidth,
				'height': popheight,
				'autoDimensions': VautoDimensions,
				'transitionIn': 'fade',
				'transitionOut': 'fade',
				'speedIn': 500,
				'speedOut': 500,
				'overlayShow': true,
				'hideOnContentClick': false,
				'overlayOpacity': 0.65,
				'overlayColor': '#000000',
				'showNavArrows': false,
				'titleShow': false
			});
			//return false;
		});
	}

	function loadfancybox(target, lightbfx, lightdur, lightit) { // options > http://fancybox.net/api
		target.fancybox({
			'transitionIn': lightbfx,
			'transitionOut': lightbfx,
			'speedIn': lightdur,
			'speedOut': lightdur,
			'overlayShow': true,
			'hideOnContentClick': true,
			'overlayOpacity': 0.85,
			'overlayColor': '#000000',
			'showNavArrows': false,
			'titleShow': lightit
		});
	}

	// We only want these styles applied when javascript is enabled
	function myGallery(thumbs, toppag, botpag, NavControls, slidesh, ssdur, lighb, lightbfx, lightdur, lightit) {
		if ($('#thumbs').length > 0) {
			$('div.navigation').css({ 'width': '300px', 'float': 'left' });
			$('div.content').css('display', 'block');
			// Initialize Advanced Galleriffic Gallery
			var gallery = $('#thumbs').galleriffic({
				delay: ssdur,
				numThumbs: thumbs,
				preloadAhead: 14,
				enableTopPager: toppag,
				enableBottomPager: botpag,
				//maxPagesToShow:            7,
				imageContainerSel: '#slideshow',
				controlsContainerSel: '#controls',
				captionContainerSel: '#caption',
				loadingContainerSel: '#loading',
				renderSSControls: false,
				renderNavControls: NavControls,
				playLinkText: 'Start Slideshow',
				pauseLinkText: 'Pauzeer Slideshow',
				prevLinkText: '&lsaquo; Vorige foto',
				nextLinkText: 'Volgende foto &rsaquo;',
				nextPageLinkText: 'Volgende &rsaquo;',
				prevPageLinkText: '&lsaquo; Vorige',
				enableHistory: false,
				autoStart: slidesh,
				syncTransitions: true,
				defaultTransitionDuration: 1500,
				onSlideChange: function (prevIndex, nextIndex) {
					// 'this' refers to the gallery, which is an extension of $('#thumbs')
					this.find('ul.thumbs').children()
					.eq(prevIndex).fadeTo('fast', vaag).end()
					.eq(nextIndex).fadeTo('fast', 1.0);
				},
				onPageTransitionOut: function (callback) {
					this.fadeTo('fast', 0.0, callback);
				},
				onPageTransitionIn: function () {
					this.fadeTo('fast', 1.0)
				},
				onTransitionIn: function (slide, caption, isSync) {
					if (lighb == true) {
						loadfancybox($("span.current a"), lightbfx, lightdur, lightit);
					}
					var duration = this.getDefaultTransitionDuration(isSync);
					slide.fadeTo(duration, 1.0);
					caption.fadeTo(duration, 1.0);
				}

			});
			var vaag = 0.67;
			$('#thumbs ul.thumbs li a img').css('opacity', vaag);
			$('#thumbs ul.thumbs li a img').hover(function () {
				$(this).fadeTo('fast', 1);
			},
											 function () {
												 $(this).fadeTo('fast', vaag);
											 });
		}

	}

});                     //end

/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */
;(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	: 'fadeslide',
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		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').stop(true,true).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);
			if (o.animation == 'fadeslide'){
				o.animation = {opacity:'show',height:'show'};
			}else
			if (o.animation == 'none'){
				o.animation = {opacity:'show'};
				o.speed = 0;
			}else
			if (o.animation == 'fade'){
				o.animation = {opacity:'show'};
			}else
			if (o.animation == 'slide'){
				o.animation = {height:'show'};
			}
			o.onBeforeShow.call($ul);
			
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);


/*
 * Supersubs v0.2b - jQuery plugin
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 *
 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
 * their longest list item children. If you use this, please expect bugs and report them
 * to the jQuery Google Group with the word 'Superfish' in the subject line.
 *
 */

;(function($){ // $ will refer to jQuery within this closure

	$.fn.supersubs = function(options){
		var opts = $.extend({}, $.fn.supersubs.defaults, options);
		// return original object to support chaining
		return this.each(function() {
			// cache selections
			var $$ = $(this);
			// support metadata
			var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
			// get the font size of menu.
			// .css('fontSize') returns various results cross-browser, so measure an em dash instead
			var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
				'padding' : 0,
				'position' : 'absolute',
				'top' : '-999em',
				'width' : 'auto'
			}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
			// remove em dash
			$('#menu-fontsize').remove();
			// cache all ul elements
			$ULs = $$.find('ul');
			// loop through each ul in menu
			$ULs.each(function(i) {	
				// cache this ul
				var $ul = $ULs.eq(i);
				// get all (li) children of this ul
				var $LIs = $ul.children();
				// get all anchor grand-children
				var $As = $LIs.children('a');
				// force content to one line and save current float property
				var liFloat = $LIs.css('white-space','nowrap').css('float');
				// remove width restrictions and floats so elements remain vertically stacked
				var emWidth = $ul.add($LIs).add($As).css({
					'float' : 'none',
					'width'	: 'auto'
				})
				// this ul will now be shrink-wrapped to longest li due to position:absolute
				// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
				.end().end()[0].clientWidth / fontsize;
				// add more width to ensure lines don't turn over at certain sizes in various browsers
				emWidth += o.extraWidth;
				// restrict to at least minWidth and at most maxWidth
				if (emWidth > o.maxWidth)		{ emWidth = o.maxWidth; }
				else if (emWidth < o.minWidth)	{ emWidth = o.minWidth; }
				emWidth += 'em';
				// set ul to width in ems
				$ul.css('width',emWidth);
				// restore li floats to avoid IE bugs
				// set li width to full width of this ul
				// revert white-space to normal
				$LIs.css({
					'float' : liFloat,
					'width' : '100%',
					'white-space' : 'normal'
				})
				// update offset position of descendant ul to reflect new width of parent
				.each(function(){
					var $childUl = $('>ul',this);
					var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
					$childUl.css(offsetDirection,emWidth);
				});
			});
			
		});
	};
	// expose defaults
	$.fn.supersubs.defaults = {
		minWidth		: 9,		// requires em unit.
		maxWidth		: 25,		// requires em unit.
		extraWidth		: 0			// extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
	};
	
})(jQuery); // plugin code ends


//z-index fix for IE7
if ($.browser.msie){
var zIndexNumber = 1000;
$('.supermenu').find('li').each(function (i) {
	$(this).css('z-index',zIndexNumber);
zIndexNumber -= 10;
});
};

/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.2, 09.03.2009
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    09.03.2009 Version 1.2
 *    - Update for jQuery 1.3.x, removed @ from selectors
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};
})(jQuery);


//resize function
(function($) {
	$.fn.resize = function(options) {
 
		var settings = $.extend({
			scale: 1,
			maxWidth: null,
			maxHeight: null
		}, options);
 
		return this.each(function() {
			
			if(this.tagName.toLowerCase() != "img") {
				// Only images can be resized
				return $(this);
			} 

			var width = this.naturalWidth;
			var height = this.naturalHeight;
			if(!width || !height) {
				// Ooops you are an IE user, let's fix it.
				var img = document.createElement('img');
				img.src = this.src;
				
				width = img.width;
				height = img.height;
			}
			
			if(settings.scale != 1) {
				width = width*settings.scale;
				height = height*settings.scale;
			}
			
			var pWidth = 1;
			if(settings.maxWidth != null) {
				pWidth = width/settings.maxWidth;
			}
			var pHeight = 1;
			if(settings.maxHeight != null) {
				pHeight = height/settings.maxHeight;
			}
			var reduce = 1;
			
			if(pWidth < pHeight) {
				reduce = pHeight;
			} else {
				reduce = pWidth;
			}
			
			if(reduce < 1) {
				reduce = 1;
			}
			
			var newWidth = width/reduce;
			var newHeight = height/reduce;
			
			return $(this)
				.attr("width", newWidth)
				.attr("height", newHeight);
			
		});
	}
})(jQuery);

//http://www.gmarwaha.com/jquery/jcarousellite/
(function($) {                                          // Compliant with jquery.noConflict()
$.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() {                           // Returns the element collection. Chainable.

		var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
		var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), 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.size(), 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);   // Full li size(incl margin)-Used for animation
		var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
		var divSize = liSize * v;                           // size of entire div(total length for just the visible items)

		li.css({width: li.width(), height: li.height()});
		ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));

		div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images

		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 circular we are in first or last, then goto the other end
					if(to<=o.start-v-1) {           // If first, then goto last
						ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
						// If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
						curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
					} else if(to>=itemLength-v+1) { // If last, then goto first
						ul.css(animCss, -( (v) * liSize ) + "px" );
						// If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
						curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
					} else curr = to;
				} else {                    // If non-circular and to points to first or last, we just return.
					if(to<0 || to>itemLength-v) return;
					else curr = to;
				}                           // If neither overrides it, the curr will still be "to" and we can proceed.

				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;
					}
				);
				// Disable buttons when the carousel reaches the last/first, and enable when not
				if(!o.circular) {
					$(o.btnPrev + "," + o.btnNext).removeClass("disabled");
					$( (curr-o.scroll<0 && o.btnPrev)
						||
					   (curr+o.scroll > itemLength-v && o.btnNext)
						||
					   []
					 ).addClass("disabled");
				}

			}
			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);


//supermenu
function supermenu(classofmenu,horver,v_width,fade1,slide1,speed,delay,arrows){
	if (horver == 'v'){
		$("ul."+classofmenu).addClass('sf-vertical');
		$(".sf-vertical, .sf-vertical li").css('width',v_width+"px");
		$(".sf-vertical li ul,.sf-vertical li.sfHover ul").css({'left':v_width+"px"});
	}

	var vspeed = speed;
	var vdelay = delay;	
	var vani = 'fadeslide';
	if(fade1 == "fade1" && slide1 == "slide1"){vani = 'fadeslide'}else
	if(fade1 == "fade0" && slide1 == "slide0"){vani = 'none'}else	
	if(fade1 == "fade1"){vani = 'fade'}else
	if(slide1 == "slide1"){vani = 'slide'}
	var varrows = false;
	if (arrows == 'arrows1'){varrows = true}
	$("ul."+classofmenu).supersubs({ 
		minWidth:    8,   // minimum width of sub-menus in em units 
		maxWidth:    12,   // maximum width of sub-menus in em units 
		extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
						   // due to slight rounding differences and font-family 
	}).superfish({ 
		delay:       vdelay,                            // one second delay on mouseout 
		animation:   vani,  							// fade-in and slide-down animation 
		speed:       vspeed,                          // faster animation speed 
		autoArrows:  varrows,                           // disable generation of arrow mark-up 
		dropShadows: false ,                         // disable drop shadows 
		onInit:        function(){},     			  // callback function fires once Superfish is initialised – 'this' is the containing ul 
		onBeforeShow:  function(){},     			  // callback function fires just before reveal animation begins – 'this' is the ul about to open 
		onShow:        function(){},     			  // callback function fires once reveal animation completed – 'this' is the opened ul 
		onHide:        function(){}     			 // callback function fires after a sub-menu has closed – 'this' is the ul that just closed     
		});								  			// call supersubs first, then superfish, so that subs are 
													 // not display:none when measuring. Call before initialising 
													 // containing tabs for same reason. 

}

//==================================
function languagemenu(classname,timout,fx){
	var fx = fx;
	var langlist = $('.'+classname);
	if(langlist.length > 0){
		langlist.css({'display':'none','position':'absolute','top':'0px','left':'0px'});
		langlist.wrap('<div id="langwrap" style="position:relative;"/>');
		$('#langwrap').wrap('<div id="langposition"/>');
		langlist.before('<div id="activelang" style="position:absolute;top:0px;left:0px;"><a href="javascript:void(0);" style="display:block;">'+$('.languagemenu li a.selected,.languagemenu li a.open,.languagemenu li a.openselected').html()+'</a></div>');	

			
			function showmenu(){
				if(fx == 'fade'){
					langlist.stop(true,true).fadeIn();
				}else if (fx == 'slide'){
					langlist.stop(false,true).slideDown();					
				}
			}
			function hidemenu(){
				if(fx == 'fade'){
					langlist.fadeOut();
				}else if (fx == 'slide'){
					langlist.slideUp();					
				}
			}
			
			$("#activelang a") 
			.mouseover( function() { 
					showmenu(); 
			}) 
			.mouseout( function() { 
					t = setTimeout(function(){ 
							hidemenu()                                      
					}, timout); // adjust your time here 
			}); 


			langlist.hover(function(){ 
					clearTimeout(t); 
			},function(){ 
					hidemenu();                                              
			}); 
	}

}

//slideshow
function slideSwitch(v1) {
		var $active = $('#rotatorWrap .item.active');
		if ( $active.length == 0 ) $active = $('#rotatorWrap .item:last');
		var $next =  $active.next().length ? $active.next()
			: $('#rotatorWrap .item:first');
		$active.addClass('last-active');
		if ($next.find('img').attr('class')) {
			var activebutt = (($next.find('img').attr('class').replace('image','')*1) + 1);
		}
		$('.rotatorcontrols a').removeClass('current');
		$('.rotatorcontrols a:nth-child('+activebutt+')').addClass('current');
		$('#rotatorWrap .item').removeClass('active');
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, v1, function() {
				$active.removeClass('active last-active');
			});
		//$('h2').html($('#rotatorWrap .item.active').find('img').attr('class'));
}



