﻿
// Constructor _________________________________________________________________

function Framework() {
		
	//init the framework
	this.init();
}

// General _____________________________________________________________________

/**
 * The init function is called in the constructor.
 */
Framework.prototype.init = function () {
	
	// Fake hover for menu elements in IE
	if ($.browser.msie) {
		Framework.prototype.fakeHover('#menu li', 'drop');
	}
	
};




// Browser Testing _____________________________________________________________

/**
 * 
 */
Framework.prototype.ie6 = function () {
	return ($.browser.msie && $.browser.version < 7);
};

/**
 * 
 */
Framework.prototype.opera8 = function () {
	return ($.browser.opera && $.browser.version < 9);
};

/**
 * Test the user's browser so that certain features are not displayed for 
 * browsers that do not support them
 */
Framework.prototype.oldBrowser = function () {
	return (this.ie6() || this.opera8());
};




// Browser-Specific Work-Arounds _______________________________________________

/**
 * Simulates :hover event for all elements in IE by adding a 'hover' class when
 * the element is moused over by the user. This method should ONLY be called by 
 * IE7 and lower!
 * 
 * Optionally specify a class to join into the fakeHover class since IE6 can't handle chained class selectors in CSS
 * Whether or not a joinClass was provided, it always adds the plain fakeHover class for backwards compability with existing CSS
 * 
 */
Framework.prototype.fakeHover = function (selection, joinClass) {
	$(selection).hover(
		function () {
			if (joinClass && $(this).hasClass(joinClass)) {
				$(this).addClass(joinClass+'_fakeHover');	
			}
			$(this).addClass('fakeHover');
		}, 
		function () {
			if (joinClass && $(this).hasClass(joinClass)) {
				$(this).removeClass(joinClass+'_fakeHover');
			}
			$(this).removeClass('fakeHover');
		}
	);
};






// Self-Instantiation __________________________________________________________

var VD = {};
VD.framework = new Framework();

