var BENMOORE = {
	cfyh: {}
};

jQuery.noConflict();

jQuery(document).ready(function() {

	jQuery("#add-this-bookmark").css("visibility","hidden");

	jQuery(window).bind('resize', function() {
		//this function is implemented by AD THIS widget
		addthis_close();
	});	

});

BENMOORE.cfyh.homepage = function () {

	var addThisClass = 'addThisDropdown';
	var that = this;

	jQuery(document).ready(function() {

		addthis_open(document.getElementById('add-this-bookmark'), '');

	});

	this.cb_bookmark_timeouts = [];

	this.cb_save = function(myURL, title, lang){
//		alert(" URL: "+myURL+"\n Title:"+title+"\n Lang:"+lang);
		openAddtoFavorite('cfyh', title, myURL, lang);
	};

	this.cb_print = function(color){
		printView(color);
	};

	this.cb_email = function(myURL, bannerURL, title, lang){
		//add the email call for ben Moore
//		alert(" URL: "+myURL+"\n Banner:"+bannerURL+"\n Title:"+title+"\n Lang:"+lang);
		openEmailToFriendLB(title, myURL, lang, bannerURL);
	};

	this.cb_bookmark = function(myURL, myBookMarkTitle, btnRight, btnTop, align){
		if (jQuery('#add-this-bookmark').prev().length) {

			jQuery('#wrap').append(
				jQuery('#add-this-bookmark').prev().children(':first-child')
						.addClass(addThisClass)
						.parent()
						.remove()
						.clone()
			);

		}

		addthis_open(document.getElementById("add-this-bookmark"), '', myURL, myBookMarkTitle);
		
		this.cb_bookmark_timeouts[this.cb_bookmark_timeouts.length] = setTimeout(this.cb_bookmark_out,1000);

		jQuery('.' + addThisClass)
				.css({'display':'block','top':'auto','right':btnRight,'bottom':(btnTop + 3),'left':'auto'})
				.bind('mouseenter',{timeout:this.cb_bookmark_timeouts},this.cb_bookmark_over);

	};
	
	this.cb_bookmark_over = function(evt) {
		jQuery.each(that.cb_bookmark_timeouts,function(i,val) {
			clearTimeout(val);
		});
		that.cb_bookmark_timeouts = [];
	};

	this.cb_bookmark_out = function() {
		addthis_close();
	};

	this.cb_bookmark_click = function(myURL, myBookMarkTitle){
		//this two functions are implemented by ADD THIS widget
		addthis_close();
		return addthis_sendto();
	};
	
	this.cb_details = function(colorCode, country){
			goToColorDetail(colorCode, country);
	};

	this.cb_roomcredits = function(roomId){
		//window.open("resources/global/flash_content/documents/CFYH2009_room_credits.doc", "_self");
		//alert("Room Credit for : " + roomId);
		openRoomCredits();
	};
	
	this.cb_fourOhFour = function(level){
//		alert("Level: "+level);
	};

};

BENMOORE.cfyh.homepageObj = new BENMOORE.cfyh.homepage();
