/**
 * @Launches the Media Gallery aka Photo Flipper
 */

if (typeof YAHOO.Edmunds == 'undefined') {
	YAHOO.Edmunds = {};
}


/**
 *	MediaGallery class can be used to launch the Media Gallery for both Edmunds and InsideLine
 *	@requires	YAHOO, YAHOO.Edmunds, YAHOO.util.Event, YAHOO.lang
 *	@class		YAHOO.Edmunds.MediaGallery
 *	@param		string	baseUrl		The URL to launch the photo flipper without any additional parameters.
 
 *	
 *	@return		void
 *	@constructor
 */
YAHOO.Edmunds.MediaGallery = function(baseUrl, width, height) {
	this.baseUrl = baseUrl;
	this.width = width;
	this.height = height;
}

/**
 * @property string Class version 
 * @static
 */
YAHOO.Edmunds.MediaGallery.VERSION = '0.0.1';

YAHOO.Edmunds.MediaGallery.prototype = {
/**
 *	Launches the Media Gallery for an article with the initial display set to the first photo of the article.
 *	@method popupArticle
 *	@param		string	articleId	Id or article
 *	@return	true
 */
    popupArticle: function(articleId) {
    	var photoWindow = window.open(this.baseUrl + '/articleId='+ articleId.replace(/\//g, "0x2F") + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },

/**
 *	Launches the Media Gallery for an article with the initial display set to the photo with the given photoId.
 *	@method popupArticlePhoto
 *	@param		string	articleId	Id or article
 *	@param		string photoId		Id of photo 
 *	@return	true
 */
    popupArticlePhoto: function(articleId, photoId) {
    	var photoWindow = window.open(this.baseUrl + '/articleId='+ articleId.replace(/\//g, "0x2F") + '/firstNav=Gallery/photoId=' + photoId + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },

/**
 *	Launches the Media Gallery for an article with the initial display set to the video with the given videoId.
 *	@method popupArticleVideo
 *	@param		string	articleId	Id or article
 *	@param		string videoId		Id of video 
 *	@return	true
 */
    popupArticleVideo: function(articleId, videoId) {
    	var photoWindow = window.open(this.baseUrl + '/articleId='+ articleId.replace(/\//g, "0x2F") + '/firstNav=Gallery/videoId=' + videoId + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    }, 
/**
 *	Launches the Media Gallery for a make, model with the initial display set to the first photo of the make, model.
 *	@method popupMakeModel
 *	@param		string	make	Name of make, can be either nicename or non-nicename
 *	@param		string	model	Name of model, can be either nicename or non-nicename
 *	@return	true
 */
    popupMakeModel: function(make, model) {
    	var photoWindow = window.open(this.baseUrl + '/make='+ make.replace(/\//g, "0x2F") + '/model='+ model.replace(/\//g, "0x2F") + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },
/**
 *	Launches the Media Gallery for a make, model with the initial display set to the photo with the given photoId.
 *	@method popupMakeModelPhoto
 *	@param		string	make	Name of make, can be either nicename or non-nicename
 *	@param		string	model	Name of model, can be either nicename or non-nicename
 *	@return	true
 */
    popupMakeModelPhoto: function(make, model, photoId) {
    	var photoWindow = window.open(this.baseUrl + '/make='+ make.replace(/\//g, "0x2F") + '/model='+ model.replace(/\//g, "0x2F") + '/photoId='+ photoId + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },
/**
 *	Launches the Media Gallery for a make, model, year with the initial display set to the first photo of the make, model, year.
 *	@method popupMakeModelYear
 *	@param		string	make	Name of make, can be either nicename or non-nicename
 *	@param		string	model	Name of model, can be either nicename or non-nicename
 *	@param		string year
 *	@return	true
 */
    popupMakeModelYear: function(make, model, year) {
    	var photoWindow = window.open(this.baseUrl + '/make='+ make.replace(/\//g, "0x2F") + '/model='+ model.replace(/\//g, "0x2F") + '/year='+ year + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },
/**
 *	Launches the Media Gallery for a make, model with the initial display set to the photo with the given photoId.
 *	@method popupMakeModelYearPhoto
 *	@param		string	make	Name of make, can be either nicename or non-nicename
 *	@param		string	model	Name of model, can be either nicename or non-nicename
 *	@param		string photoId		Id of photo 
 *	@return	true
 */
    popupMakeModelYearPhoto: function(make, model, year, photoId) {
    	var photoWindow = window.open(this.baseUrl + '/make='+ make.replace(/\//g, "0x2F") + '/model='+ model.replace(/\//g, "0x2F") + '/year='+ year + '/photoId='+ photoId + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },
/**
 *	Launches the Media Gallery for a make, model with the initial display set to the video with the given videoId.
 *	@method popupMakeModelVideo
 *	@param		string	make	Name of make, can be either nicename or non-nicename
 *	@param		string	model	Name of model, can be either nicename or non-nicename
 *	@param		string videoId		Id of video
 *	@return	true
 */
    popupMakeModelVideo: function(make, model, videoId) {
    	var photoWindow = window.open(this.baseUrl + '/make='+ make.replace(/\//g, "0x2F") + '/model='+ model.replace(/\//g, "0x2F") + '/videoId='+ videoId + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },
/**
 *	Launches the Media Gallery for a make, model, year with the initial display set to the video with the given videoId.
 *	@method popupMakeModelYearVideo
 *	@param		string	make	Name of make, can be either nicename or non-nicename
 *	@param		string	model	Name of model, can be either nicename or non-nicename
 *	@param		string videoId		Id of video
 *	@return	true
 */
    popupMakeModelYearVideo: function(make, model, year, videoId) {
    	var photoWindow = window.open(this.baseUrl + '/make='+ make.replace(/\//g, "0x2F") + '/model='+ model.replace(/\//g, "0x2F") + '/year='+ year + '/videoId='+ videoId + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },
/**
 *	Launches the Media Gallery for a vehicle style with the initial display set to the first photo of the style.
 *	@method popupStyle
 *	@param		string	styleId	styleId of the vehicle
 *	@return	true
 */
    popupStyle: function(styleId) {
    	var photoWindow = window.open(this.baseUrl + '/styleId='+ styleId + '/firstNav=Gallery' + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    },

/**
 *	Launches the Media Gallery for a vehicle style with the initial display set to the photo with the given photoId.
 *	@method popupStylePhoto
 *	@param		string	styleId	styleId of the vehicle
 *	@param		string photoId		Id of photo 
 *	@return	true
 */
    popupStylePhoto: function(styleId, photoId) {
    	var photoWindow = window.open(this.baseUrl + '/styleId='+ styleId + '/firstNav=Gallery/photoId=' + photoId + '', '', 'toolbar=no,statusbar=no,menubar=no,scrollbars=no,resizable=no' + ',width=' + this.width + ',height=' + this.height);
	photoWindow.focus();
	return true;
    }
}
