/**
2 * @author leondewan
3 */
var lastshown='';

(function($){
	$.musa_compare={	
		_init:function(){			
			$.musa_compare.hideInit();	
			$.musa_compare.showTable();
		},
		
		hideInit: function(){
			for(i=2; i<modelCount; i++){			
				$('.col' + i).hide();
			}			
		},
		
		showTable:function(){
			$('.comparetable').show();
		},
		
		showCol:function(className){
			if(lastshown=='') $('.col1').hide()
			else {
				$('.' + lastshown).hide();
			}
			
			$('.' + className).show();
			lastshown=className;
		},		
		
		popup:function(videoFile, elemPos) {	
			// Large videos
			if (vehiclecode == "cx7") {
				$('#video_popup').css("top", $(elemPos).offset().top-110);	
				$('#video_popup').css("left", 26);

				// sets the updated file location for the file associated with the 2010 modelYear 
				var so = new SWFObject(musaUrl +"musa2/flash/garage/2010/" + vehiclecode + "/musa/overview/baseCompareVideo.swf", "bod", "720", "340", "9");

				so.addVariable("videoID", videoFile);
				so.addVariable("applicationUrl", appUrl);
				so.addParam("wmode", "transparent");
				so.addParam("allowFullScreen", "true");
				so.addParam("allowScriptAccess", "always");
				// sets the updated file location for the file associated with the 2010 modelYear
				so.addParam("base", musaUrl +"musa2/flash/garage/2010/" + vehiclecode + "/musa/overview/");
			} 
			// Small videos
			else {
				$('#video_popup').css("top", $(elemPos).offset().top-105);	
				$('#video_popup').css("left", 10);

				// sets the updated file location for the file associated with the 2010 modelYear 
				var so = new SWFObject(musaUrl +"musa2/flash/garage/2010/" + vehiclecode + "/musa/compare/p_garage_" + vehiclecode+ "_compare_base.swf", "bod", "383", "189", "9");

				so.addVariable("videoFile", videoFile);
				so.addVariable("applicationUrl", appUrl);
				so.addParam("wmode", "transparent");
				so.addParam("allowScriptAccess", "always");
				// sets the updated file location for the file associated with the 2010 modelYear
				so.addParam("base", musaUrl +"musa2/flash/garage/2010/" + vehiclecode + "/musa/compare/");
			}
			
			so.write("video_popup");	
			
						
			$('#video_popup').fadeIn(400);		
		},
		
		popupClose:function(specId, elemPos) {				
			$('#video_popup').fadeOut(400);		
		}
	}	
	$.musa_compare._init();	
	
})(jQuery);

function inlinePopupDisplay(videoFile, elemPos) {
	$.musa_compare.popup(videoFile, elemPos);
}

function videoCloseAll() {
	$.musa_compare.popupClose();
}

// Large video close
function popupClose() {
	$.musa_compare.popupClose();
}

// hide video link if flash is not present
$(function () {
	if 	( !((new SWFObject("","",0,0,"")).installedVer.major < 9 || ((new SWFObject("","",0,0,"")).installedVer.major == 9 && (new SWFObject("","",0,0,"")).installedVer.minor == 0 && (new SWFObject("","",0,0,"")).installedVer.rev < 124 )) ) {
		$(".viewVideo").css("display","inline-block");
	}
});





