$(document).ready(function(){
//flash-detection
	if( typeof(isNewDashboard) == "undefined" ) isNewDashboard = false;
	if( typeof(isNC2011) == "undefined" ) isNC2011 = false;
	if( typeof(useNCVersion) == "undefined" ) {
		swfVersionToUse="";
	} else {
		swfVersionToUse=useNCVersion;
	}

	if (cmsflash != true) { 
		if( typeof(module_name) == "undefined" ) module_name = "temp";
		/*
				try {
					if (module_name) {}
				} catch (err) {
					var myVar = "temp";
				}
		*/
		if (module_name == "xmas_special") { 
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				$('#flashContent').before($('#toolbar-underlay'));
				flashpath = "../../global/Triumph_Xmas.swf";
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:0};
				var params 		= {menu:"false", bgcolor:"#000000", base:"", allowfullscreen:"false", wmode:"transparent"};
				var attributes 	= {id:"triumph", name:"Triumph"};
				swfobject.embedSWF("../../global/Triumph_Xmas.swf?v="+Math.random(), "flashContent", "1024", "600", "9.0.124", "../../global/js/emo/expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 600, 1920, 1200);
			} else {
				$('#flashContent').css('visibility', 'visible');
			}

		}
		if (module_name == "xmas_special_2011") 
		{ 
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) 
			{
				$('#flashContent').before($('#toolbar-underlay'));
				flashpath = "../../global/swf/xmas2011/Triumph_XMas2011.swf";
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:0};
				var params 		= {menu:"false", bgcolor:"#EFEAE4", base:"", allowfullscreen:"false", wmode:"opaque"}; // wmode:"transparent"
				var attributes 	= {id:"triumph", name:"Triumph"};
				swfobject.embedSWF("../../global/swf/xmas2011/Triumph_XMas2011.swf?v="+Math.random(), "flashContent", "1024", "600", "9.0.124", "expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 600, 1920, 1200);
			} 
			else 
			{
				$('#flashContent').css('visibility', 'visible');
			}
		}
		else if (module_name == "shape_sensation_2"){
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				$('#flashContent').before($('#toolbar-underlay'));
				flashpath = "../../global/swf/shape2/Triumph_ShapeSensation.swf";
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:0};
				var params 		= {menu:"false", bgcolor:"#000000", base:"", allowfullscreen:"true", wmode:"opaque"};
				var attributes 	= {id:"triumph", name:"Triumph"};
				swfobject.embedSWF("../../global/swf/shape2/Triumph_ShapeSensation.swf", "flashContent", "1024", "680", "9.0.124", "expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 630, 1920, 1200);  //990, 650
			
			} else {
				$('#flashContent').css('visibility', 'visible');
			}
		}
		else if (module_name == "ShapeMagAW11"){
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				
				$('#flashContent').before($('#toolbar-underlay'));
				// $('#flashContent').before($('#logo'));
				
				flashpath = "../../global/swf/shape3/Triumph_ShapeSensation3.swf";
				// var flashvars	= {rootpath:module_path, pathIMG:"", verbose:0};
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:"0", layout:"0", overridefont:""};
				//verbose (1|0): Fehlermeldungen anzeigen/unterdrücken
				//layout (1|0): layout=0 ist fürs aktuelle Triumphlayout -> die Seite wird 32 Pixel nach unten geschoben, um Platz für die Navi zu haben (default:0)
				//overridefont ("font_latin.swf"|"font_latin_special.swf"|"font_greek.swf"|"font_cyrillic.swf"|"font_chinese.swf"): zum Testen anderer Sprachen. VOR LIVEGANG UNBEDINGT ENTFERNEN!!!

				var params 		= {menu:"false", bgcolor:"#000000", base:"", allowfullscreen:"true", wmode:"opaque"};
				var attributes 	= {id:"triumph", name:"Triumph"};
				swfobject.embedSWF("../../global/swf/shape3/Triumph_ShapeSensation3.swf", "flashContent", "1024", "680", "9.0.124", "expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 660, 1920, 1200);  //990, 650
			
			} else {
				$('#flashContent').css('visibility', 'visible');
			}
		}
		else if (module_name == "ShapeMagSS12"){
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				
				$('#flashContent').before($('#toolbar-underlay'));
				// $('#flashContent').before($('#logo'));
				
				flashpath = "../../global/swf/shape4/Triumph_ShapeSensation4.swf";
				// var flashvars	= {rootpath:module_path, pathIMG:"", verbose:0};
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:"0", layout:"0", overridefont:""};
				//verbose (1|0): Fehlermeldungen anzeigen/unterdrücken
				//layout (1|0): layout=0 ist fürs aktuelle Triumphlayout -> die Seite wird 32 Pixel nach unten geschoben, um Platz für die Navi zu haben (default:0)
				//overridefont ("font_latin.swf"|"font_latin_special.swf"|"font_greek.swf"|"font_cyrillic.swf"|"font_chinese.swf"): zum Testen anderer Sprachen. VOR LIVEGANG UNBEDINGT ENTFERNEN!!!

				var params 		= {menu:"false", bgcolor:"#000000", base:"", allowfullscreen:"true", wmode:"opaque"};
				var attributes 	= {id:"triumph", name:"Triumph"};
				swfobject.embedSWF("../../global/swf/shape4/Triumph_ShapeSensation4.swf", "flashContent", "1024", "680", "9.0.124", "expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 660, 1920, 1200);  //990, 650
			
			} else {
				$('#flashContent').css('visibility', 'visible');
			}
		}
		else if (module_name == "essence"){
			/* kalmes (20101-05-30): change essence specific parameters here*/
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				$('#flashContent').before($('#toolbar-underlay'));
				flashpath = "../../global/swf/essence/Triumph_Essence.swf";
				
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:"0", layout:"0", overridefont:""};
				//verbose (1|0): Fehlermeldungen anzeigen/unterdrücken
				//layout (1|0): layout=0 ist fürs aktuelle Triumphlayout -> die Seite wird 32 Pixel nach unten geschoben, um Platz für die Navi zu haben (default:0)
				//overridefont ("font_latin.swf"|"font_latin_special.swf"|"font_greek.swf"|"font_cyrillic.swf"|"font_chinese.swf"): zum Testen anderer Sprachen. VOR LIVEGANG UNBEDINGT ENTFERNEN!!!
				
				var params 		= {menu:"false", bgcolor:"#000000", base:"", allowfullscreen:"true", wmode:"opaque"}; //
				var attributes 	= {id:"triumph", name:"Triumph"};
				
				swfobject.embedSWF("../../global/swf/essence/Triumph_Essence.swf?v="+Math.random(), "flashContent", "1024", "630", "9.0.124", "expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 660, 1920, 1080);
			} 
			else
			{
				$('#flashContent').css('visibility', 'visible');
			}
		}
		else if (module_name == "essence2"){
			/* kalmes (20101-05-30): change essence specific parameters here*/
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				$('#flashContent').before($('#toolbar-underlay'));
				flashpath = "../../global/swf/essence2/Triumph_Essence2.swf";
				
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:"0", layout:"0", overridefont:""};
				//verbose (1|0): Fehlermeldungen anzeigen/unterdrücken
				//layout (1|0): layout=0 ist fürs aktuelle Triumphlayout -> die Seite wird 32 Pixel nach unten geschoben, um Platz für die Navi zu haben (default:0)
				//overridefont ("font_latin.swf"|"font_latin_special.swf"|"font_greek.swf"|"font_cyrillic.swf"|"font_chinese.swf"): zum Testen anderer Sprachen. VOR LIVEGANG UNBEDINGT ENTFERNEN!!!
				
				var params 		= {menu:"false", bgcolor:"#000000", base:"", allowfullscreen:"true", wmode:"opaque"}; //
				var attributes 	= {id:"triumph", name:"Triumph"};
				
				swfobject.embedSWF("../../global/swf/essence2/Triumph_Essence2.swf?v="+Math.random(), "flashContent", "1024", "630", "9.0.124", "expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 660, 1920, 1080);
			} 
			else
			{
				$('#flashContent').css('visibility', 'visible');
			}
		}
		else if (module_name == "bodymakeup"){
			/* kalmes (20101-01-18): change essence specific parameters here*/
			var minFlashVersion = 9;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				$('#flashContent').before($('#toolbar-underlay'));
				flashpath = "../../global/swf/bodymakeup/Triumph_Bodymakeup.swf";
				
				var flashvars	= {rootpath:module_path, pathIMG:"", verbose:"1", layout:"0"};
				//verbose (1|0): Fehlermeldungen anzeigen/unterdrücken
				//layout (1|0): layout=0 ist fürs aktuelle Triumphlayout -> die Seite wird 32 Pixel nach unten geschoben, um Platz für die Navi zu haben (default:0)
				//overridefont ("font_latin.swf"|"font_latin_special.swf"|"font_greek.swf"|"font_cyrillic.swf"|"font_chinese.swf"): zum Testen anderer Sprachen. VOR LIVEGANG UNBEDINGT ENTFERNEN!!!
				
				var params 		= {menu:"false", bgcolor:"#EFEAE4", base:"", allowfullscreen:"false", wmode:"opaque"}; // wmode:"transparent"
				var attributes 	= {id:"triumph", name:"Triumph"};
				
				swfobject.embedSWF("../../global/swf/bodymakeup/Triumph_Bodymakeup.swf?v="+Math.random(), "flashContent", "100%", "710", "9.0.124", "expressInstall.swf", flashvars, params, attributes);
				swffit.fit("triumph", 990, 660, 1920, 1080);
			} 
			else
			{
				$('#flashContent').css('visibility', 'visible');
			}
		}
		else {		
			//no special module
			flashpath = (isNewDashboard === true) ? "../../global/Main_nc2010.swf" : "../../global/Main.swf";
			if(isNC2011 == true) {
				flashpath = "../../global/Main_nc2011.swf";
			}
			if (swfVersionToUse!="") {
				flashpath = "../../global/Main_nc2011_"+swfVersionToUse+".swf";
			}
					
	        var flashvars = {
	          rootpath: root_path
	        };
	        var params = {
	          /*base : "./front/",*/
	          scale: "noscale",
	          allowFullScreen: "true",
	          wmode: "transparent"
	        };

			var minFlashVersion = 10;
			var flashVersion = swfobject.getFlashPlayerVersion();
			if( flashVersion.major >= minFlashVersion && flashVersion.major > 0 ) {
				$('#flashContent').before($('#toolbar-underlay'));
				swfobject.embedSWF(flashpath, "flashContent", "100%", "100%", "10.0.0", "../../global/js/emo/expressinstall.swf", flashvars, params, {id: 'flashContent'});
				swffit.fit("flashContent",940,600);
			} else if( flashVersion.major < minFlashVersion && flashVersion.major > 0 ) {
				if( typeof(fallback_path) == "undefined" ) fallback_path = '';
				if( fallback_path.length > 0 ) { 
					$.cookie( 'fallback_url', window.location.href );
					window.location.href = window.location.protocol + '//' + window.location.host + fallback_path;
				} else {
					$('#flashContent').css('visibility', 'visible');
				}
			} else {
				$('#flashContent').css('visibility', 'visible');
			}
		}
	} else {
		$('#flashContent').css('visibility', 'visible');
    }
});


/**
 * @author alexander.farkas
 */

(function($){
    
    function callOnReady(){

    }
    $(callOnReady);

})(jQuery);


(function($){
    (function($){
        $.widget('ui.imageGallery', {
            init: function(){
                var that = this, o = this.options;
                this.links = $(o.link, this.element[0]);
                this.imageStage = $(o.imageStage, this.element[0]);
                this.imageStage.attr('tabIndex', '-1');
                if ($.imgPreLoad) {
                    this.links.each(function(){
                        $.imgPreLoad.add($(this).attr('href'));
                    });
                }
                function switchPic(e){
                  $(this).animate({
                        opacity: 0
                        }, {
                          duration: 300,
                          complete: function(){
                            var allSlidesContainer = $(this).closest("ul");
                            allSlidesContainer.find('li').show();
                            $(this).animate({
                                  opacity: 100
                                  }, {
                                  duration: 300});
                            $(this).parent().parent().hide();
                          }
                        });
                    that.switchImgStage.call(that, this, e);
                    setTimeout(function(){
                        that.imageStage.focus();
                    }, 200);
                    return false;
                }
                this.links.bind('click.imageGallery', switchPic).attr('role', 'button');
                
            },
            switchImgStage: function(elm, e){

                var jElm = $(elm), src = jElm.attr('href');
                this.links.removeClass('active');
                jElm.addClass('active');
                if (!this.options.switchImgFn) {
                    $('img', this.imageStage).attr('src', src);
                }
                else {
                    this.options.switchImgFn.call(this, src, jElm);
                }
            }
        });
        $.ui.imageGallery.defaults = {
            link: 'a',
            imageStage: 'div.photo',
            switchImgFn: false
        };
    })(jQuery);
    var zoomGallery = (function(){
        var img, jImg, zoomContainer, gallery, galleryDim, nowDim, dimArray, poses, zoomImage;
        
        function constrainToGallery(left, top, width, height){
            width = width || parseFloat(img.style.width, 10);
            height = height || parseFloat(img.style.height, 10);
            
            var maxMin = $.objScale.constrainMaxMinPositionForContainer(
                {
                    width: width, 
                    height: height
                }, galleryDim, 
                {
                    left: left,
                    top: top
                });
            return [maxMin.left, maxMin.top];
        }
        
        function dragImg(e){
            
            var x = poses.x - e.clientX, 
                y = poses.y - e.clientY, 
                left = poses.left - x, 
                top = poses.top - y;
            var nPos = constrainToGallery(left, top);
            nPos[0] = nPos[0] || 0;
            nPos[1] = nPos[1] || 0;
            img.style.left = nPos[0] + 'px';
            img.style.top = nPos[1] + 'px';
            poses = {
                x: e.clientX || 0,
                y: e.clientY || 0,
                top: nPos[1],
                left: nPos[0]
            };
        }
        function scale(){
            var dir = (this.className == 'zoom-in') ? 1 : -1;
           
            if (dimArray[nowDim + dir]) {
                nowDim += dir;
                var pos = {
                        top: parseFloat(img.style.top) + ((parseFloat(img.style.height) - dimArray[nowDim].height) / 2),
                        left: parseFloat(img.style.left) + ((parseFloat(img.style.width) - dimArray[nowDim].width) / 2)
                    },
                    cPos = constrainToGallery(pos.left, pos.top, dimArray[nowDim].width, dimArray[nowDim].height);
                
                pos.left = cPos[0];
                pos.top = cPos[1];
                var css = $.extend({}, dimArray[nowDim], pos);
                jImg.animate(css, {duration: 200});
            }
            return false;
        }
        function mouseDown(e){
            poses = {
                x: e.clientX,
                y: e.clientY,
                top: parseFloat(img.style.top, 10),
                left: parseFloat(img.style.left, 10)
            };
        }
        
        function prepareNewImg(){
            var imgDim = $.objScale.scaleSidesIn(this, galleryDim),
                difDim = {
                    width: galleryDim.width - imgDim.width,
                    height: galleryDim.height - imgDim.height
                };
            if(difDim.width < 5 && difDim.width > 0){
                imgDim.height = $.objScale.scaleWidthTo(imgDim, galleryDim.width);
                imgDim.width = galleryDim.width;
            } else if(difDim.height < 5 && difDim.height > 0){
                imgDim.width = $.objScale.scaleHeightTo(imgDim, galleryDim.height);
                imgDim.height = galleryDim.height;
                
            }
            var maxDim = {width: this.width, height: this.height};
            
            nowDim = 0;
            var stepWidth = (Math.abs(imgDim.width - maxDim.width)) / 3, stepHeight = (Math.abs(imgDim.height - maxDim.height)) / 3;
            dimArray = $.extend({}, imgDim);
            delete dimArray.margin;
            dimArray = [dimArray];
            for (var i = 0; i < 2; i++) {
                dimArray.push({
                    width: imgDim.width + stepWidth,
                    height: imgDim.height + stepHeight
                });
                
                stepWidth += stepWidth;
                stepHeight += stepHeight;
            }
            dimArray.push($.extend({}, maxDim));
            var css = {
                position: 'absolute',
                width: imgDim.width,
                height: imgDim.height,
                top: imgDim.margin[0],
                left: imgDim.margin[1],
                opacity: 0
            };
            jImg.css(css)
                .prependTo(zoomContainer[0])
                .animate({
                    opacity: 1
                },
                {
                    duration: 200
                })
                .bind('mousedown', mouseDown);
            
            
            var mouseDrag = new MouseDrag();
            mouseDrag.mouseInit();
            
        }
        function MouseDrag(){
            this.element = jImg;
            this.options = $.ui.mouse.defaults;
        }
        $.extend(MouseDrag.prototype, $.ui.mouse, {
            mouseDrag: dragImg
        });
        function switchImage(src, jElm){
            $('img:first', zoomContainer[0]).animate({
                opacity: 0
            }, {
                duration: 300,
                complete: function(){
                    $(this).remove();
                }
            });
            img = new Image();
            jImg = $(img);
            jImg.load(prepareNewImg);
            img.src = src;
        }
        function init(){
            gallery = $('#ser_right');
            zoomImage = $('#zoom-image');
            if (gallery[0] && zoomImage.length == 0) {
                var imgSrc = $('#ser_slider a').attr('href');
                img = new Image();
                zoomContainer = $('<div id="zoom-image"><div class="zoom-control"><a href="#" class="zoom-in">zoom in</a><a href="#" class="zoom-out">zoom out</a></div></div>');
                zoomContainer.appendTo('#ser_middle_bg');
                galleryDim = {
                    width: $('#zoom-image').innerWidth(),
                    height: $('#zoom-image').innerHeight()
                };
                $('#ser_right').imageGallery({
                    imageStage: '#zoom-image',
                    link: '#ser_slider a',
                    switchImgFn: switchImage
                });
                jImg = $(img);
                jImg.load(prepareNewImg);
                img.src = imgSrc;
                $('a', zoomContainer[0]).click(scale);
            }
        }
        return {
            init: init,
            element: jImg,
            dragImg: dragImg
        };
    })();
    
    function callSlider(){
      if($("#ser_slider").length == 1){
        $("#ser_slider li[id='"+stdProduct+"']").hide();
        $("#ser_slider").easySlider({
          prevText:'UP',
          nextText:'DOWN',
          orientation:'vertical',
          showElements:'5',
          hiddenElements:'1',
          contHeight: '430',
          nextButt:'ser_right_next',
          prevButt:'ser_right_prev'
        });
      }
    }

    function callGallSlide(){
      if($("#dbgallery_slider").length == 1){
        $('#dbgallery_slider').easySliderGall({
          prevText:'UP',
          nextText:'DOWN',
          orientation:'horizontal',
          showElements:'1',
          prevButt:'dbgallery_prev',
          nextButt:'dbgallery_next',
          contWidth:'441'
        });
      }
    }

    function callTeaser(){
      if($('.teasing').length > 0){
        $('.teasing').mouseover(function(){
          $('.teaseOverlayText', this).show('slow')
        }).mouseout(function(){
          $('.teaseOverlayText', this).hide('fast');
        });
      }
    }

    function callGalleryReady(){
        zoomGallery.init();
        callSlider();
        callTeaser();
        callGallSlide();
		if (env == 'cms') {
	       	if ($("#dbgallery_slider").length > 0) {
            	if ($.cookie('galleryLogic') != null)
        			var gallLogic = $.cookie('galleryLogic');
				else
					var gallLogic = 1;
			
				if (redDotModeOn) {
                	$.each($('#dbgallery_slider').children('ul').children('li'), function() {
                    	if ($(this).attr('id') != 'id' + gallLogic)
                        	$(this).remove();
                	});
                	$('div#dbgallery_next').remove();
               		$('div#dbgallery_prev').remove();
				} else {
			    	for (var i = 0; i < gallLogic - 1; i++)
			        	$('div#dbgallery_next').children('img').click();
			    	$.cookie('galleryLogic', null, { expires: 99999 });
				}
	            $('div#dbgallery_next').click(function() {
	            	gallLogic++;
	            	if (gallLogic >= $('#dbgallery_slider').children('ul').children('li').length)
	                	gallLogic = $('#dbgallery_slider').children('ul').children('li').length;
	                $.cookie('galleryLogic', gallLogic, { expires: 99999 });
	            });
	            $('div#dbgallery_prev').click(function() {
	            	if (!(gallLogic <= 1))
	                	gallLogic--;
	                $.cookie('galleryLogic', gallLogic, { expires: 99999 });
	            });
        	}
		}
    }
    $(callGalleryReady);
})(jQuery);

$(document).ready(function(){
  $("#seg_slider").easySlider({
    prevText:'UP',
    nextText:'DOWN',
    orientation:'vertical',
    showElements:'2',
    contHeight: '332',
    nextButt:'ser_right_next',
    prevButt:'ser_right_prev'
  });
});

$(document).ready(function(){
//DASHBOARD: Page Flip on hover
  $("#pageflip").hover(function() {
    $('.arrow').hide();
    $("#pageflip img , .msg_block").stop()
      .animate({
        width: '105px', 
        height: '105px'
      }, 500); 
    } , function() {
    $("#pageflip img").stop() 
      .animate({
        width: '50px', 
        height: '52px'
      }, 220);
    $(".msg_block").stop() 
      .animate({
        width: '50px', 
        height: '52px'
      }, 200);
  });
});

$(document).ready(function(){
//DASHBOARD: Arrows on hover
  $('#dashmap area').mouseenter(function() {
    showID = $(this).attr('class');
    $('.arrow').hide();
    $('#'+showID).show();
    });
});

$(document).ready(function(){
//DASHBOARD-GALLERY: OV on hover

});


$(document).ready(function(){
  $("#newsSlider").newsHPSlider({
    prevText:'UP',
    nextText:'DOWN',
    orientation:'horizontal',
    showElements:'2',
    nextButt:'teaser_pager_next',
    prevButt:'teaser_pager_prev'
  });
});

$(document).ready(function(){
  if($("#ncStartSegPol_ov").length == 0){
    countOv = $('.ncStartSegPol').length;
    for(i=0;i<countOv;i++){
      if(i!=0){
        $selectedNC = $('.ncStartSegPol:eq('+i+')').removeClass();
        $selectedNC.addClass('ncStartSegPol nc0'+(i));
      }
    }
    $('.ncStartSegPol').show();
  }
});

$(document).ready(function(){
	if( $.browser.msie && parseInt($.browser.version) < 7 ) {
		if( $('*').is('#pageflip') ) {
			$('#pageflip img').attr('src', '../../global/css/emo/img/page_flip.gif')
		}
		$('#dbgallery_prev img').ifixpng();
		$('#dbgallery_next img').ifixpng();
	}
});

$(document).ready(function()
{
	if( $.isFunction( $(".gfoC").fancybox ) )
	{
    	$(".gfoC").fancybox({
		'width' : 750,
		'height' : 560,
		'showCloseButton' : false,
		'autoScale' : false,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe'
		});
	}
});

// *** UPDATE STORELOCATOR ***//
$(document).ready(function()
{
	if( $.isFunction( $(".sloC").fancybox ) )
	{
    	$(".sloC").fancybox({
		'width' : 750,
		'height' : 610,
		'showCloseButton' : false,
		'autoScale' : false,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe'
		});
	}
});
// *** UPDATE STORELOCATOR ***//

// *** UPDATE SHAPE SENSATION 3 ***//
$(document).ready(function() 
{
	if( typeof(current_render_mode) != "undefined" && typeof(show_facebook_like) != "undefined" )
	{
		// both varibales are set, so new template version of ewt_bas_emo is current
		if(current_render_mode == "2" && show_facebook_like == "1")
		{
			// cms live version 
			var urlToLike = encodeURIComponent(window.location.href.toString().replace(/#(.)+/g, ''));
			$('body').append('<div id="fbook" style="z-index:1; position:absolute; top: 60px; left:25px; overflow: hidden;"><iframe src=\'http:\/\/www.facebook.com\/plugins\/like.php?href='+urlToLike+'&layout=button_count&show_faces=false&width=200&action=like&font=arial&colorscheme=light&amp;height=21\' scrolling=\'no\' frameborder=\'0\' style=\'border:none; overflow:hidden; width:200px; height:21px\' allowTransparency=\'true\'><\/iframe></div>');
		}
	}
});
// *** UPDATE SHAPE SENSATION 3 ***//

function callFancybox( url, width, height )
{
	$(document).ready(function () 
	{
		var iWidth = 750;
		var iHeight = 560;
		if(typeof width != "undefined")
		{
			iWidth = parseInt(width);
		}
		if(typeof height != "undefined")
		{
			iHeight = parseInt(height);
		}
		if(typeof url == "undefined" || url == "")
		{
			alert("callFancybox(): Parameter 'url' is undefined or empty!");
			url = "http://www.triumph.com";
		}
			
        $.fancybox({
			'width' : iWidth,
			'height' : iHeight,
			'showCloseButton' : false,
			'autoScale' : false,
			'transitionIn' : 'none',
			'transitionOut' : 'none',
			'type' : 'iframe',
			'href': url
        });
	});
}
//*** Needed for XMAS Special 2011 ***//
