/*
* WebShop
* 
* @brief: main class for webshop, init all others, except product category handler
* @args:	needSiteSpecific:Boolean - need to init site specific things (optional)
*/
function WebShop( needSiteSpecific , jsMenuResizable ) {
	this.wsSite = null;
	this.wsProduct = null;
	this.wsForm = null;
	this.wsProductCat = null;
	this.wsAnswer = null;
	this.wsComplaint = null;
	this.wsUtil = null;
	this.isAdmin = false;
	this.jsMenuNeedToResized = true;
	this.menuStyle = 0;
	this.clearNeeded = false;
	this.selectedSkin = 'skin';
	
	this.wsForm = new WebShopForm();						// create form obj
	this.wsProduct = new ProductHandler( '' );				// create product obj
	this.wsProduct.initTrail();								// init product
	this.wsProductCat = new ProductCategoryHandler( 0 );	// create product category obj, for this time init as 0 max_fokat, in template there is an other init needed
	this.wsUtil = new WebShopUtil();						// create util
	this.wsAnswer = new AnswerHandler();
	this.wsComplaint = new ComplaintHandler();
	
	if( ( typeof( jsMenuResizable ) != 'undefined' ) && ( jsMenuResizable == false ) ) {	// js menü beállítás
		this.jsMenuNeedToResized = false;
	}
	
	if( ( typeof( needSiteSpecific ) != 'undefined' ) && ( needSiteSpecific == true ) ) {	// init site spec thing
		this.wsSite = new Site( this );
		if( typeof( this.wsSite.init ) == 'function' ) {
			this.wsSite.init();
		}
	}
	
}

/*
* WebShop.setAdmin
* 
* @brief: sets admin flag
* @args:	value:Boolean - true or false depends on call from admin (optional)
* @return:	-
*
*/
WebShop.prototype.setAdmin = function( value ) {
	if( typeof( value ) != 'undefined' ) {
		this.isAdmin = value;
	}
}

/*
* WebShop.getAdmin
* 
* @brief: gets admin flag
* @args:	-
* @return:	boolean, the value of the flag
*
*/
WebShop.prototype.getAdmin = function() {
	return this.isAdmin;
}

/*
* WebShop.getWSUtil
* 
* @brief: gets util obj
* @args:	-
* @return:	obj of util
*
*/
WebShop.prototype.getWSUtil = function() {
	return this.wsUtil;
}

/*
* WebShop.getWSSite
* 
* @brief: gets site obj
* @args:	-
* @return:	obj of site
*
*/
WebShop.prototype.getWSSite = function() {
	return this.wsSite;
}

/*
* WebShop.getWSCat
* 
* @brief: gets category obj
* @args:	-
* @return:	obj of categories
*
*/
WebShop.prototype.getWSCat = function() {
	return this.wsProductCat;
}

/*
* WebShop.getWSForm
* 
* @brief: gets form obj
* @args:	-
* @return:	obj of form validation
*
*/
WebShop.prototype.getWSForm = function() {
	return this.wsForm;
}

/*
* WebShop.getWSProduct
* 
* @brief: gets product obj
* @args:	-
* @return:	obj of products
*
*/
WebShop.prototype.getWSProduct = function() {
	return this.wsProduct;
}

WebShop.prototype.getWSAnswer = function() {
	return this.wsAnswer;
}

ws = new WebShop( true , false );	// init webshop


jQuery( function() {
	// BUTTONS
	jQuery('.fg-button').hover(
		function(){ jQuery(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
		function(){ jQuery(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
	);

	// MENUS
	jQuery('#hierarchy').menu( {
		content: jQuery('#hierarchy').next().html(),
		crumbDefaultText: ' '
	} );

	jQuery('#hierarchybreadcrumb').menu( {
		content: jQuery('#hierarchybreadcrumb').next().html(),
		backLink: false
	} );
});

