/*******************************************************
 * klasa Logishop do najbardziej ogolnych  zastosowan
 ******************************************************/

var Logicms = 
{

	indicatorId : 'indicator',
	
		/*********************
		 * POKAZ INDICATOR *
		 *********************/
	
	showIndicator: function(msg)
	{
		var indicator = $('#'+Logicms.indicatorId);
    
        var indicator_msg = $('#indicator_msg');
		
        indicator_msg.html('Proszę czekać - trwa '+msg+'...');

		win_center = Logicms.winSize();
		pg_offset = Logicms.scrollSize();
		indicator.css('left', (win_center[0]/2-75+pg_offset[0])+'px');
		indicator.css('top', (win_center[1]/2-50+pg_offset[1])+'px');
        if(indicator.css('visibility') == 'hidden')
          indicator.css('visibility', 'visible');
		indicator.show();
		
	}, // showIndicator()
	
	
		/*********************
		 * SCHOWAJ INDICATOR *
		 *********************/
	hideIndicator : function ()
	{
		if($('#'+Logicms.indicatorId))
		{
			$('#'+Logicms.indicatorId).hide();
		}
	}, // hideIndicator()
	
	//------------------------------------

	winSize : function () {
		var x,y;
		// wszystko poza IE
		if (window.innerHeight) {
			x = window.innerWidth;
			y = window.innerHeight;
		}
		// IE 6 Strict Mode
		else if (document.documentElement && document.documentElement.clientHeight) {
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		// pozostale IE
		else if (document.body) {
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		return new Array (x, y);
	},

	scrollSize : function  () {
		var x,y;
		// wszystko poza IE
		if (self.pageYOffset || self.pageXOffset) {
			x = self.pageXOffset;
			y = self.pageYOffset;
		}
		// IE 6 Strict
		else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		}
		// pozostale IE
		else if (document.body) {
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		return new Array (x, y);
	},	
		
	viewSize : function  ()
	{
		var x,y;
		// wszystko poza IE
		if (self.innerHeight) {
			x = self.innerWidth;
			y = self.innerHeight;
		}
		// IE 6 Strict Mode
		else if (document.documentElement && document.documentElement.clientHeight) {
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		// pozostale IE
		else if (document.body) {
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		return new Array (x, y);
	},

	popUp : function(url, name, left, top, width, height, scrollbars) 
	{
	    window.open(url, name, "left="+left+",top="+top+",width="+width+",height="+height+",scrollbars="+scrollbars);
	    return false;		
	},
  
	toggleElement: function(element_id, duration)
	{
    	if(!duration)
    		duration = 500;
  		$('#'+element_id).slideToggle(duration);
	  	return false;
	},
	
	printContent : function(url)
	{
		var h=700;
		var w=818;
		window.open(url, "printable_window", "scrollbars=1, left=100, top=100, width="+w+", height="+h);
	}

} // end Logicms
