var latestOpenedItems = null;
var latestOpenedTitle = null;
var latestOpenedOuter = null;
var latestOpenedSB = null;
var latestOpenedArrow = null;
var expandedState = "closed";
var strMainImagePath="/yamahavgn/cda/images/paragon/";
var inMaskMode = false;

var isIOS =( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i) ) ? true : false;
var isiPhone =( navigator.userAgent.match(/iPhone/i) ) ? true : false;
var isiPad =( navigator.userAgent.match(/iPad/i) ) ? true : false;
var isiPod =( navigator.userAgent.match(/iPod/i) ) ? true : false;
var isChrome = ( navigator.userAgent.match(/Chrome/i) ) ? true : false;
var isSafariMac = ( navigator.userAgent.match(/safari/i) && navigator.userAgent.match(/mac/i) )? true : false;
var isSafariPC = ( navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/mac/i) )? true : false;
var isSafari = ( navigator.userAgent.match(/safari/i) )? true : false;

function arrowHover(pID,pDir){
	if(pDir=="off"){
		if(pID.src.indexOf("open") >-1){		
			pID.src=strMainImagePath + "open_off.png";
		}
		else{
			pID.src= strMainImagePath + "close_off.png";
		}
	}
	else if(pDir=="on"){
		if(pID.src.indexOf("open") >-1){
			pID.src=strMainImagePath + "open_on.png";
		}
		else{
			pID.src=strMainImagePath + "close_on.png";
		}	
	}
}

function showhideHover(pID,pDir){
	if(pDir=="off"){
		if(pID.src.indexOf("show") >-1){
			pID.src=strMainImagePath + "show_details_off.png";	
		}
		else{
			pID.src=strMainImagePath + "hide_details_off.png";	
		}
	}
	else if(pDir=="on"){
		if(pID.src.indexOf("show") >-1){
			pID.src=strMainImagePath + "show_details_on.png";	
		}
		else{
			pID.src=strMainImagePath + "hide_details_on.png";	
		}
	}
}

function showHideDetailsRight(pID,pMode){
	var objItems = document.getElementById("cdc_"+pID);
	var objOuter = document.getElementById("coc_"+pID);
	var objSectB = document.getElementById("csb_"+pID);
	var objArrow = document.getElementById("car_"+pID);
	var objTitle = document.getElementById("cnt_"+pID);

	if(objItems.style.display == "none"){
		objItems.style.display = "";
		objTitle.style.color = "#e34e03";
		objOuter.className = "connect-outer-container-on";
		objSectB.style.display = "";
		objArrow.src=strMainImagePath + "close_off.png";
	}
	else if (objItems.style.display == ""){
		objItems.style.display="none";
		objTitle.style.color = "";
		objOuter.className = "connect-outer-container";
		objSectB.style.display="none";
		objArrow.src=strMainImagePath + "open_off.png";
	}
}


function collObject(pCID,pCNM,pTHP,pIID,pDIM,pFMT,pSIZ){
	this.cid = pCID;
	this.cname = pCNM;
	this.thumb = pTHP;
	this.iid = pIID;
	this.idims = pDIM;
	this.ifmt = pFMT;
	this.isize = pSIZ;
}

var level1BlockTop,level2BlockTop;
//if(is_safari){level1BlockTop=-32;level2BlockTop=-54;}else{level1BlockTop=29;level2BlockTop=4;}
level1BlockTop=40;level2BlockTop=0;
var MENUTD_POS = [
// Level 0 block configuration
{

	'height'     : 40,
	'vertical'   : false,
	'table'      : [0, 0, 0], // [cellpadding, cellspacing, border]
	'expd_delay' : 0,'hide_delay' : 300,	

	'css' : {		
		'table' : 'mtable', 
		'outer' : 'mouter',		
		'inner' : ['minner', 'minner-over', 'minner-over']
	}	
},
// Level 1 block configuration
{
	'height' : 22,'width' : 204, 'block_top'  :level1BlockTop,	'block_left' : 3,
	'table'      : [0, 1, 0],
	'wise_pos'   : 1,
	'vertical'   : true,
	'shadow' : {'offX' : 4,	'offY' : 3,	'color' : '#777777'	},'opacity' : 100,
	'css' : {'table' : 'm1table1','outer' : ['m1out1', 'm1over1', 'm1over1'],'inner' : ['minner1', 'minner-over1', 'minner-over1']}
},
// Level 2 block configuration
{
	'width' : 210,	'block_top'  : level2BlockTop,	'block_left' : 196,
	'css' : {'table' : 'm1table2','outer' : ['m1out2', 'm1over2', 'm1over2'],'inner' : ['minner2', 'minner-over2', 'minner-over2']}
},
// Level 3 block configuration
{
	'width' : 210,	'block_top'  : level2BlockTop,	'block_left' : 196,
	'css' : {'table' : 'm1table2','outer' : ['m1out2', 'm1over2', 'm1over2'],'inner' : ['minner2', 'minner-over2', 'minner-over2']}
}
]




var YOU_ITEMS = [
	['', '',{'tw': '_self','sb': 'Y.O.U. Categories','sw':213, 'nm': ''},
	['All','#',{'tw': '_self','sb': 'All', 'nm': ''}],
	['Employees','#',{'tw': '_self','sb': 'Employees', 'nm': ''}],
	['Music Production','#',{'tw': '_self','sb': 'Music Production', 'nm': ''}],
	['Live Sound','#',{'tw': '_self','sb': 'Live Sound', 'nm': ''}],
	['Keyboards & Pianos','#',{'tw': '_self','sb': 'Keyboards & Pianos', 'nm': ''}],
	['Guitars & Basses','#',{'tw': '_self','sb': 'Guitars & Basses', 'nm': ''}],
	['Drums & Percussion','#',{'tw': '_self','sb': 'Drums & Percussion', 'nm': ''}],
	['Band & Orchestral','#',{'tw': '_self','sb': 'Band & Orchestral', 'nm': ''}],
	['Student','#',{'tw': '_self','sb': 'Student', 'nm': ''}]
	]	
];


function EmbedProgVideo(pID,pSWF,pVersion,pWidth,pHeight,pFlashvars,pDivId,pH264Name,pPoster,pTitle,pControls){
	//document.getElementById("spinner").style.display="";

	var vID,vName,vVersion,vWidth,vHeight,vScriptAccess,vSWF,vQuality,vWmode,vBGColor,vFlashvars,vPoster,vTitle,vFLVName,vH264Name
	var pmName,pmVersion,pmScriptAccess,pmMovie,pmQuality,pmWmode,pmBGColor,pmFlashvars;
	var emID,emName,emScriptAccess,emSource,emQuality,emWmode,emBGColor,emFlashvars;
	var bParamsOK, cCodeBase, cClassID, cPluginspage, sOutput;


// Check if SWF name passed...
	bParamsOK = (pH264Name!="" || pFLVName!="") ? true : false;

// Set constant values	...
	cClassID = "classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";
	cCodeBase = "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=";
	cPluginspage = "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" ";

// Set Defaults if no values passed...
	vID = (trim(pID)!="") ? "id=\"" + pID + "\" " : "";
	vName = (trim(pID)!="") ? "name=\"" + pID + "\" " : "";
	vVersion = (trim(pVersion)!="") ? pVersion : "9,0,0,0";
	vWidth = (trim(pWidth)!="") ? "width=\"" + pWidth + "\" " : "width=\"100%\" ";
	vHeight = (trim(pHeight)!="") ? "height=\"" + pHeight + "\" " : "height=\"100%\" ";
	vScriptAccess = "sameDomain";
	vQuality = "high";
	vWmode = "transparent";
	vBGColor = "#ffffff";
	if(pH264Name != undefined)
	{
	vH264Name = (trim(pH264Name)!="") ? trim(pH264Name) : trim(pH264Name);
	}
	if(vPoster != undefined)
	{              
	vPoster = (trim(pPoster)!="") ? "poster=\"" + trim(pPoster) + "\" " : "poster=\"" + trim(pPoster) + "\" ";
	}
	vTitle = (trim(pTitle)!="") ? "title=\"" + trim(pTitle) + "\" " : "title=\"" + trim(pTitle) + "\" ";
	vControls = (trim(pControls)!="") ? trim(pControls) : trim(pControls);

// Build <param> tag values for IE...
	pmScriptAccess = "<param name=\"allowscriptaccess\" value=\"" + vScriptAccess + "\"> "
	pmWmode = "<param name=\"wmode\" value=\"" + vWmode + "\"> "
	pmMovie = "<param name=\"movie\" value=\"" + pSWF + "\"> "
	pmQuality = "<param name=\"quality\" value=\"" + vQuality + "\"> "
	pmBGColor = "<param name=\"bgcolor\" value=\"" + vBGColor + "\"> "
	pmFullScreen =  "<param name=\"allowFullScreen\" value=\"true\"> ";
	pmFlashvars = (trim(pFlashvars)!="") ? "<param name=\"flashvars\" value=\"" + pFlashvars + "\"> " : "" ;

// Build <embed> tag name/value pairs for MAC / Netscape, etc...
	emScriptAccess = "allowscriptaccess=\"" + vScriptAccess + "\" "
	emWmode = "wmode=\"" + vWmode + "\" "
	emSource = "src=\"" + pSWF + "\" "
	emQuality = "quality=\"" + vQuality + "\" "
	emBGColor = "bgcolor=\"" + vBGColor + "\" "
	emFullScreen = "allowFullScreen=\"true\" ";
	emFlashvars = (trim(pFlashvars)!="") ? "flashvars=\"" + pFlashvars + "\" " : "" ;

// Create document.write string...

	sOutput = "";

	if( (isIOS==true || isSafari==true || isChrome==true || 1==2) && vH264Name!=""){
		sOutput = sOutput + "<video  " + vID + vPoster + vTitle + vWidth + vHeight + " " + vControls + " autoplay>" ; // + vID
		sOutput = sOutput + "<source src=\"" + vH264Name + "\" type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"' /></video>" ;
	}
	else if(pFlashvars!=""){
		sOutput = sOutput + "<object " + vID + vName + cClassID + cCodeBase + vVersion + "\" " + vWidth + vHeight + ">" ;
		sOutput = sOutput + pmScriptAccess + pmWmode + pmMovie + pmQuality + pmBGColor + pmFullScreen + pmFlashvars ;
		sOutput = sOutput + "<embed " + emSource + emScriptAccess + emWmode + emQuality + emBGColor + emFullScreen + emFlashvars ;
		sOutput = sOutput + cPluginspage + vWidth + vHeight + "</embed></object>" ;
	}
	else{
		bParamsOK == false;
	}
	
	if(bParamsOK == true){
		var obj=document.getElementById(pDivId);
		if(typeof obj == "object"){
			obj.innerHTML=sOutput;	
			if( (isIOS==true || isSafari==true || isChrome==true || 1==2) && vH264Name!=""){
				$('#'+pID).bind('pause', function() {					 
					//
				});
				$('#'+pID).bind('ended', function() {
					 $eovshowquestions();
				});
				if(isSafari==true || isIOS==true){
					$('#you_video_div').css('height','306px');
					$('#video_questions_div').css('height','306px');
				}
				else if(isChrome==true){
					$('#questions_div').addClass("html5-chrome-ctrl");
				}	
				$('#'+pID).bind('canplay', function() {
					$('#'+pID).play();
				});
			}				
		}	
	}
	else{
		alert("Please specify the proper parameters for the video object...");
	}
}

// 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;
	},
	galleria: function (_, 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;
	},

	galleriaIn: function (_, t, b, c, d) {
			return c*(t/=d)*t*t*t + b;
	},

	galleriaOut: function (_, t, b, c, d) {
			return -c * ((t=t/d-1)*t*t*t - 1) + b;
	}
});

function oninit()
{

var method1 = 'easeOutSine';
		method1 = 'easeOutQuart';
		method1 = 'galleria';
		//method1= 'easeOutQuint';
		
	$('.media-coll-title').live("click", function() {
		var cur = $(this).next("div").next("div");
		var outer = $(this).parents('div.media-outer-container');
		var outeron = $(this).parents('div.media-outer-container-on');
		var curarrow = $(this).find("img.updown-arrow");
		if ( cur.is(':visible') ){
			outeron.removeClass("media-outer-container-on");
			outeron.addClass("media-outer-container");
			curarrow.attr('src', strMainImagePath + "open_off.png");
		}
		else{
			outer.removeClass("media-outer-container");
			outer.addClass("media-outer-container-on");
			curarrow.attr('src', strMainImagePath + "close_off.png");
		}
		var method1 = 'easeOutSine';
		method1 = 'easeOutQuart';
		method1 = 'easeOutQuint';
	
		
		cur.animate(
				{height: 'toggle'},
				{
					duration: 300,easing: method1,
					step: function(now, fx) {
						cur.removeClass("media-coll-data")
						cur.find(".item-thumb").each(function(index){		
									if( $(this).width() < $(this).height() ){								
									var whprop = $(this).width()/$(this).height()
									$(this).width(200*whprop);
									$(this).height(200);
									var leftmgn = (160 - (200*whprop))/2;
									$(this).css("marginLeft",leftmgn);
									$(this).css("marginRight",leftmgn);
									$(this).css("margintop",4);
								}
								else{
									$(this).width(160);
								}
						});
						
					}
				}
			);
		
	});
	
	$('#show_hide_btn').live("click", function() {
		var method1 = 'easeOutQuint';
		if( $('#show_hide_btn').attr('src').indexOf("show")>-1 )	{
			$('#show_hide_btn').attr('src', strMainImagePath + "hide_details_off.png");
			$('.media-coll-title').find("img.updown-arrow").attr('src', strMainImagePath + "close_off.png");		
			$('.media-coll-title').parents('div.media-outer-container').removeClass("media-outer-container").addClass("media-outer-container-on");
			$('.media-coll-title').each(function(index) {				
					if(! $(this).next("div").next("div").is(':visible') ){
					//	$(this).next("div").next("div").animate({height: 'toggle'}, {duration: 300, easing: method1});
						var cur = $(this).next("div").next("div");
						
						cur.animate(
						{height: 'toggle'},
						{
							duration: 300,easing: method1,
							step: function(now, fx) {
								cur.removeClass("media-coll-data")
								cur.find(".item-thumb").each(function(index){		
											if( $(this).width() < $(this).height() ){								
											var whprop = $(this).width()/$(this).height()
											$(this).width(200*whprop);
											$(this).height(200);
											var leftmgn = (160 - (200*whprop))/2;
											$(this).css("marginLeft",leftmgn);
											$(this).css("marginRight",leftmgn);
											$(this).css("margintop",4);
										}
										else{
											$(this).width(160);
										}
								});
								
							}
						}
					);
									
					}
			});
			
		}
		else{
			$('#show_hide_btn').attr('src', strMainImagePath + "show_details_off.png");
			$('.media-coll-title').find("img.updown-arrow").attr('src', strMainImagePath + "open_off.png");
			$('.media-coll-title').parents('div.media-outer-container-on').removeClass("media-outer-container-on").addClass("media-outer-container");
			$('.media-coll-title').each(function(index) {				
					if( $(this).next("div").next("div").is(':visible') ){
						$(this).next("div").next("div").animate({height: 'toggle'}, {duration: 300, easing: method1});
					}
			});
		}		
	});	

	$('.fwdit-list-item-div').live("click", function() {
		var cur = $(this).next("div").next("div");
		var outer = $(this).parents('div.fwdit-outer-container');
		var outeron = $(this).parents('div.fwdit-outer-container-on');
		var curarrow = $(this).find("img.updown-arrow");
		if ( cur.is(':visible') ){
			outeron.removeClass("fwdit-outer-container-on");
			outeron.addClass("fwdit-outer-container");
			curarrow.attr('src', strMainImagePath + "open_off.png");
			$(this).css('font-weight','bold').css('color','#555');
		}
		else{
			outer.removeClass("fwdit-outer-container");
			outer.addClass("fwdit-outer-container-on");
			curarrow.attr('src', strMainImagePath + "close_off.png");
			$(this).css('font-weight','bold').css('color','#000');
		}
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});
	});
		
	$('.fwdit-info-icon').live("click", function(){	
			alert('who fired?');																	
	});	
	
	$('#fwdit_sort').hover( 
		function () { 
			if($('#fwdit_sort_arrow').attr('name')=="Arrow_up_16x16"){
				$('#fwdit_sort_arrow').attr('src', strMainImagePath + "Arrow_up_16x16_on.png");				
			}
			else{
				$('#fwdit_sort_arrow').attr('src', strMainImagePath + "Arrow_down_16x16_on.png");
			}
		},  
		function () { 
			if($('#fwdit_sort_arrow').attr('name')=="Arrow_up_16x16"){
				$('#fwdit_sort_arrow').attr('src', strMainImagePath + "Arrow_up_16x16_off.png");				
			}
			else{
				$('#fwdit_sort_arrow').attr('src', strMainImagePath + "Arrow_down_16x16_off.png");
			}
		} 
	); 
	
	$('#fwdit_sort').live("click", function(){
		if($('#fwdit_sort_arrow').attr('name')=="Arrow_up_16x16"){
			$('#fwdit_sort_arrow').attr('src', strMainImagePath + "Arrow_down_16x16_off.png");	
			$('#fwdit_sort_arrow').attr('name','Arrow_down_16x16');
		}
		else{
			$('#fwdit_sort_arrow').attr('src', strMainImagePath + "Arrow_up_16x16_off.png");
			$('#fwdit_sort_arrow').attr('name','Arrow_up_16x16');
		}
	});
	

//alert( curOpenIndex);
	$('.fwdit-metric-coll-div').live("click",function(obj) {
//alert( curOpenIndex);
		var curIndex = $("div.fwdit-metric-coll-div").index(this);
		var cur = $("div.fwdit-metric-coll-div").eq(curIndex).next("div");
		var outer = $(this).parents('div.fwdit-metric-outer-container');
		var outeron = $(this).parents('div.fwdit-metric-outer-container-on');
		var curarrow = $(this).find("img.fwdit-metric-updown-arrow");	
	
		if(curIndex!=curOpenIndex && curOpenIndex!=null){
			var curOpen = $("div.fwdit-metric-coll-div").eq(curOpenIndex).next("div");
			var outeronOpen = $("div.fwdit-metric-coll-div").eq(curOpenIndex).parents('div.fwdit-metric-outer-container-on');
			var curarrowOpen = $("div.fwdit-metric-coll-div").eq(curOpenIndex).find("img.fwdit-metric-updown-arrow");
			outeronOpen.removeClass("fwdit-metric-outer-container-on");
			outeronOpen.addClass("fwdit-metric-outer-container");
			curarrowOpen.attr('src', strMainImagePath + "open_off.png");
			curOpen.animate({height: 'toggle'}, {duration: 300, easing: method1});				 //, easing: 'easeOutQuad'
			
		}		
		if ( cur.is(':visible') ){
			outeron.removeClass("fwdit-metric-outer-container-on");
			outeron.addClass("fwdit-metric-outer-container");
			curarrow.attr('src', strMainImagePath + "open_off.png");
			curOpenIndex = null;
		}
		else{
			outer.removeClass("fwdit-metric-outer-container");
			outer.addClass("fwdit-metric-outer-container-on");
			curarrow.attr('src', strMainImagePath + "close_off.png");	
			curOpenIndex = curIndex;
		}		
		
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});	 //, easing: 'easeOutQuad'
	
	} );
	
	
	$('#you_show_hide_btn').live("click",function(){
		if($('#questions_div').is(':visible')){
			$(this).attr('src', '/yamahavgn/cda/images/paragon/btn_showQuestions.png');
			$(this).attr('title', 'Show Questions');
			if(isIOS==true){
				$('#you_video_div').show();
			}
		}
		else{
			$(this).attr('src', '/yamahavgn/cda/images/paragon/btn_hideQuestions.png');
			$(this).attr('title', 'Hide Questions');
			if(isIOS==true){
					$('#you_video_div').hide();
			}
		}
		$('#questions_div').animate({height: 'toggle'}, {duration: 500, easing: method1});
	});
	
	$eovshowquestions = function(){
		if($('#questions_div').is(':visible')){	}
		else{
			$('#you_show_hide_btn').attr('src', '/yamahavgn/cda/images/paragon/btn_hideQuestions.png');	
			$('#questions_div').animate({height: 'toggle'}, {duration: 500, easing: 'easeOutBounce'});
			$('#you_show_hide_btn').attr('title', 'Hide Questions');
		}
	}
	
	$('.you-coll-div').live("click",function() {
		// Get the content that needs to be shown
		var cur = $(this).next("div");//.next("div");
		var outer = $(this).parents('div.you-outer-container');
		var outeron = $(this).parents('div.you-outer-container-on');
		var curarrow = $(this).find("img.you-updown-arrow");
		if ( cur.is(':visible') ){
			outeron.removeClass("you-outer-container-on");
			outeron.addClass("you-outer-container");
			curarrow.attr('src', strMainImagePath + "open_off.png");
		}
		else{
			outer.removeClass("you-outer-container");
			outer.addClass("you-outer-container-on");
			curarrow.attr('src', strMainImagePath + "close_off.png");
		}
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});

	} );

	/*$('.you-item-div').hover( 
		function () { 
			$(this).addClass("you-item-div-on");
		},  
		function () { 
			$(this).removeClass("you-item-div-on");
		} 
	); */

	$('.you-item-div').live('mouseover mouseout', function(event) {
  if (event.type == 'mouseover') {
   
			$(this).addClass("you-item-div-on");

  } else {

			$(this).removeClass("you-item-div-on");

  }
});


	$('.you-video-thumb').live("click",								
	function () {
		if($('#questions_div').is(':visible')){
			$('#you_show_hide_btn').attr('src', '/yamahavgn/cda/images/paragon/btn_showQuestions.png');	
			$('#questions_div').animate({height: 'toggle'}, {duration: 500, easing: 'easeOutBounce'});
			$('#you_show_hide_btn').attr('title', 'Show Questions');
		}
		if($('#you_cat_container').is(':visible')){
			$('#you_cat_container').hide();
			$('#you_container').animate({height: 'toggle'}, {duration: 500, easing: 'galleria'});
		}		
			EmbedProgVideo('v1',p1SWF,'','','','cpath='+$(this).attr('filename'),'you_video_div',$(this).attr('m4v_file'),$(this).attr('poster'),$(this).attr('title'),'controls');
			$('#you_video_title').text($(this).attr('title'));
	}); 

	$('.you-item-icon').live("click",								
		function () {
			if(!$('#questions_div').is(':visible')){
				$('#you_show_hide_btn').attr('src', '/yamahavgn/cda/images/paragon/btn_hideQuestions.png');	
				$('#questions_div').animate({height: 'toggle'}, {duration: 500, easing: 'easeOutBounce'});
				$('#you_show_hide_btn').attr('title', 'Hide Questions');
			}
			
			if($('#you_cat_container').is(':visible')){
				$('#you_cat_container').hide();
				$('#you_container').animate({height: 'toggle'}, {duration: 500, easing: 'galleria'});
			}		
				EmbedProgVideo('v1',p1SWF,'','','','cpath='+$(this).attr('filename'),'you_video_div',$(this).attr('filename'),$(this).attr('poster'),$(this).attr('title'),'controls');
				$('#you_video_title').text($(this).attr('title'));
		}); 

	
	$('#you_browse_cat_btn').live("click",	function (){
		if($('#you_container').is(':visible')){
			$('#you_container').hide();
			$("#you_video_div").html("");
			$('#you_cat_container').animate({height: 'toggle'}, {duration: 300, easing: 'galleria'});
		}			
	});

	$('.you-cat-img').animate({	opacity: 0.60	});
	
	$('.you-cat-img').hover( 
												
		function () { 
			$(this).animate({	opacity: 0.90, width: '+=5'	}, {duration: 100, easing: 'easeOutQuint'});
		},  
		function () { 
			$(this).animate({	opacity: 0.60, width: '-=5'	}, {duration: 300, easing: 'easeOutQuint'});
		} 
	); 
	
	$('.you-location-title').live("click", function() {
		var cur = $(this).next("div").next("div");
		var outer = $(this).parents('div.you-rpt-outer-container');
		var outeron = $(this).parents('div.you-rpt-outer-container-on');
		var curarrow = $(this).find("img.updown-arrow");
		if ( cur.is(':visible') ){
			outeron.removeClass("you-rpt-outer-container-on");
			outeron.addClass("you-rpt-outer-container");
			curarrow.attr('src', strMainImagePath + "open_off.png");
		}
		else{
			outer.removeClass("you-rpt-outer-container");
			outer.addClass("you-rpt-outer-container-on");
			curarrow.attr('src', strMainImagePath + "close_off.png");
		}
		var method1 = 'easeOutSine';
		method1 = 'easeOutQuart';
		method1 = 'easeOutQuint';
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});
	});
	
	$('.you-rpt-store-div').live("click", function() {
		var cur = $(this).next("div");		
		var outer = $(this).parents('div.you-rpt-outer-container');
		var outeron = $(this).parents('div.you-rpt-outer-container-on');
		var curarrow = $(this).find("img.updown-arrow");
		if ( cur.is(':visible') ){
			outeron.removeClass("you-rpt-outer-container-on");
			outeron.addClass("you-rpt-outer-container");
			curarrow.attr('src', strMainImagePath + "open_off.png");
		}
		else{
			outer.removeClass("you-rpt-outer-container");
			outer.addClass("you-rpt-outer-container-on");
			curarrow.attr('src', strMainImagePath + "close_off.png");
		}
		var method1 = 'easeOutQuint';
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});
	});
	
	$('.you-cegrpt-dlr-td1').live("click", function() {
		var cur = $(this).parents('div.you-cegrpt-dlr-div').next("div");
		var outer = $(this).parents('div.you-rpt-outer-container');
		var outeron = $(this).parents('div.you-rpt-outer-container-on');
		var curarrow = $(this).find("img.updown-arrow");
		if ( cur.is(':visible') ){
			outeron.removeClass("you-rpt-outer-container-on");
			outeron.addClass("you-rpt-outer-container");
			curarrow.attr('src', strMainImagePath + "open_off.png");
		}
		else{
			outer.removeClass("you-rpt-outer-container");
			outer.addClass("you-rpt-outer-container-on");
			curarrow.attr('src', strMainImagePath + "close_off.png");
		}
		var method1 = 'easeOutQuint';
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});
	});
	
	$('.you-cegrpt-str-td1').live("click", function() {
		var cur = $(this).parents('div.you-cegrpt-str-div').next("div");
		var curarrow = $(this).find("img.updown-detail-arrow");
		if ( cur.is(':visible') ){
			curarrow.attr('src', strMainImagePath + "ICON_showdetailArrow_down.png");
		}
		else{
			curarrow.attr('src', strMainImagePath + "ICON_showdetailArrow_up.png");
		}
		var method1 = 'easeOutQuint';
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});
	});
	
	$('.you-rpt-cat-div').live("click", function() {
		var cur = $(this).next("div");		
		var curarrow = $(this).find("img.updown-detail-arrow");
		if ( cur.is(':visible') ){
			curarrow.attr('src', strMainImagePath + "ICON_showdetailArrow_down.png");
		}
		else{
			curarrow.attr('src', strMainImagePath + "ICON_showdetailArrow_up.png");
		}
		var method1 = 'easeOutQuint';
		cur.animate({height: 'toggle'}, {duration: 300, easing: method1});
	});
	
	
	$('tr.you-rpt-data-tr').hover( 
		function () { 
			$(this).css("backgroundColor", "#b2cdc2").css("color", "#000000");//#7EAB99
		},  
		function () { 
			$(this).css("backgroundColor", "#ffffff").css("color", "#555555");
		} 
	); 
	
	//.live("click", function() 
	$('tr.you-rpt-data-tr').find("img.you-rpt-print-icon").each(function(index){
			$(this).parents('tr.you-rpt-data-tr').fancybox({
				'showCloseButton'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'type'				: 'iframe',
				'width': 890,
				'height': 682,
				'margin':0,
				'padding':0,
				'autoScale':false,
				'scrolling':'no',
				'overlayShow':true,
				'href': $(this).attr("href")
		});
	});
	
	$('tr.you-rpt-data-tr').find("img.you-rpt-inproc-icon").each(function(index){		
		var curHREF = $(this).attr("href");																																		
		$(this).parents('tr.you-rpt-data-tr').bind("click", function() {
			if(curHREF!="" && curHREF!= undefined){			
				document.location.href = curHREF ;
			}
		});
	});
	$('tr.you-rpt-data-tr').find("img.you-rpt-pending-icon").each(function(index){		
		var curHREF = $(this).attr("href");																																		
		$(this).parents('tr.you-rpt-data-tr').bind("click", function() {
			if(curHREF!="" && curHREF!= undefined){			
				document.location.href = curHREF ;
			}
		});
	});
	$('tr.you-rpt-data-tr').find("td.you-rpt-employee-data-td-left").each(function(index){		
		var curHREF = $(this).attr("href");																																		
		$(this).parents('tr.you-rpt-data-tr').bind("click", function() {
			if(curHREF!="" && curHREF!= undefined){			
				document.location.href = curHREF ;
			}
		});
	});
	
	
	$(".you-rpt-print-icon").fancybox({
		'showCloseButton'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'iframe',
		'width': 890,
		'height': 682,
		'margin':0,
		'padding':0,
		'autoScale':false,
		'scrolling':'no',
		'overlayShow':true
	});
	
	$(".you-email-report-icon").fancybox({
		'width'         : 530,
		'height'        : 410,
		'margin'        : 0,
		'transitionIn'  : 'elastic',
		'transitionOut' : 'elastic',
		'type'          : 'iframe',
		'overlayShow'   : false
	});
	
	$("div.pop-user-cert").each(function(index){
      $(this).fancybox({
				'width'         : 530,
				'height'        : 230,
				'margin'        : 0,
				'transitionIn'  : 'elastic',
				'transitionOut' : 'elastic',
				'type'          : 'iframe',
				'overlayShow'   : false
     });
});
	
	
	$('.qr-pop-img').fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'image'

	});
	
	$('.url-pop-inline').fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'inline'

	});
$(".you-item-print-icon").fancybox({
		'showCloseButton'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'iframe',
		'width': 890,
		'height': 682,
		'margin':0,
		'padding':0,
		'autoScale':false,
		'scrolling':'no',
		'overlayShow':true
	});

$(".you-next-button-img").fancybox({
	'showCloseButton'	: false,
	'transitionIn'	: 'elastic',
	'transitionOut'	: 'elastic',
	'type'				: 'iframe',
	'width': 890,
	'height': 682,
	'margin':0,
	'padding':0,
	'autoScale':false,
	'scrolling':'no',
	'overlayShow':true
});
	$(".media-collection-image").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'image'
	});
	$(".media-information").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'margin':0,
		'type'				: 'inline'
	});
	$("a.pop-video").each(function(index){
      $(this).fancybox({
                'width'                  : 640,
                'height'                 : 360,
                'margin'                : 0,
                'transitionIn'      : 'elastic',
                'transitionOut'  : 'elastic',
                'type'                     : 'iframe',
                'overlayShow'   : false
     });
});

}

function pageLoad(sender, args)
{
   if(args.get_isPartialLoad())
   {
      $('.qr-pop-img').fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'image'

	});
	
	$('.url-pop-inline').fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'inline'

	});
$(".you-item-print-icon").fancybox({
		'showCloseButton'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'iframe',
		'width': 890,
		'height': 682,
		'margin':0,
		'padding':0,
		'autoScale':false,
		'scrolling':'no',
		'overlayShow':true
	});

		$(".you-next-button-img").fancybox({
	'showCloseButton'	: false,
	'transitionIn'	: 'elastic',
	'transitionOut'	: 'elastic',
	'type'				: 'iframe',
	'width': 890,
	'height': 682,
	'margin':0,
	'padding':0,
	'autoScale':false,
	'scrolling':'no',
	'overlayShow':true
});
		

$(".media-collection-image").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'type'				: 'image'
	});
	$(".media-information").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'margin':0,
		'type'				: 'inline'
	});
$("a.pop-video").each(function(index){
      $(this).fancybox({
                'width'                  : 640,
                'height'                 : 360,
                'margin'                : 0,
                'transitionIn'      : 'elastic',
                'transitionOut'  : 'elastic',
                'type'                     : 'iframe',
                'overlayShow'   : false
     });
});

  }
}



$(document).ready(oninit);

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*
/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 
 ;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
