// JavaScript Document

// GLOBAL VARS \
var cnt_one = 0;
var objDBG = new gmw_ahotDebugger;
var initSize = 100;
// GLOBAL VARS /

function gmw_ahotTimer(){
	
	this.objT = null;	
	this.delay = 100;
	this.fuja = 'alert(\'Working...\');';
	
	this.timer_init = function(delay, fuja){		
		this.delay = delay;
		this.fuja = fuja;
	}
	
	this.timer_start = function(){			
		objT = setTimeout (this.fuja, this.delay);
	}
	
	this.timer_stop = function(){	
		if(objT != null){
			clearTimeout(objT);
		}		
	}
	
}

function gmw_ahotDebugger(){

	var objTarget = null;

	this.init = function(id){
	
		divTag = document.createElement("div");
			str_lend = '<br />';
       
        divTag.id = id;
      	divTag.style.margin = "0px auto";
		divTag.style.backgroundColor = "#000000";
		divTag.style.width = "80%";		
		divTag.style.color = "#2AFF00";		
		// divTag.style.border = "1px solid #CCCCCC";
		// divTag.style.padding = "5px";
        divTag.style.overflow = "hidden";
		
      		document.body.appendChild(divTag);
		
		objTarget = divTag;		
		objTarget.innerHTML = 'Init Debugger...' + str_lend;
	}
	
	this.flush = function(message){
		objTarget.innerHTML += message + str_lend;
	}	
}


// ****************************** \
// ACCORDION MENU -
// GMW - DESIGN ::


var objT4R = new gmw_ahotTimer;

function gmw_initResizer(id){
	gmw_activeElement = id;
	gmw_resizer();
}

function gmw_resizer(){

		arrGMWSetting[gmw_activeElement].current_height = arrGMWSetting[gmw_activeElement].current_height + arrGMWSetting[gmw_activeElement].step;		

		if( (arrGMWSetting[gmw_activeElement].height) > (arrGMWSetting[gmw_activeElement].current_height)){
			document.getElementById(arrGMWSetting[gmw_activeElement].id).style.height = arrGMWSetting[gmw_activeElement].current_height + "px";	
					
				var i = 0;
				while(i < arrGMWSetting.length){
				/// minimize the others \
					if(i != gmw_activeElement){
						
						if(arrGMWSetting[i].current_height == 0){
							// skipity skip...
						}
						else{						
							arrGMWSetting[i].current_height = arrGMWSetting[i].current_height - arrGMWSetting[i].step;
							document.getElementById(arrGMWSetting[i].id).style.height = arrGMWSetting[i].current_height + "px";							
						}						
						document.getElementById(arrGMWSetting[i].id).style.overflow="hidden";
					}					
					i++;
				/// minimize the others \	
				}
		}
		else{
			// clearTimeout(objTimer);
			objT4R.timer_stop();
			
			 i = 0;
			 
				while(i < arrGMWSetting.length){
				/// minimize the others \
				
					if(i != gmw_activeElement){					
							arrGMWSetting[i].current_height = 0;
							document.getElementById(arrGMWSetting[i].id).style.height = arrGMWSetting[i].current_height + "px";								
					}
					else{
						document.getElementById(arrGMWSetting[i].id).style.overflow="visible";	
					}
					i++;
				/// minimize the others \	
				}			
			return;
		}		
		objT4R.timer_init(arrGMWSetting[gmw_activeElement].timeout, "gmw_resizer()");		
		objT4R.timer_start();
}

// ACCORDION MENU -
// ****************************** /



// initiation ...

// navi definition \

var gmw_activeElement = 0;

var json_gmwElement1 = {
	"id" : "gmw-section1",
	"height" : 446,
	"current_height" : 0,
	"step" : 20,
	"timeout" : 1
}

var json_gmwElement2 = {
	"id" : "gmw-section2",
	"height" : 446,
	"current_height" : 0, 
	"step" : 20,
	"timeout" : 1
}

var json_gmwElement3 = {
	"id" : "gmw-section3",
	"height" : 10,
	"current_height" : 0,
	"step" : 5,
	"timeout" : 1
}

var arrGMWSetting = new Array();
	arrGMWSetting[0] = json_gmwElement1;
	arrGMWSetting[1] = json_gmwElement2;
	arrGMWSetting[2] = json_gmwElement3;
	
// navi definition /

function initAhotGMW(){
	gmw_initResizer(0);
}


// initiation ...


// FB **** \

	var tmr_fb = null;
	var height_min = 80;
	var height_max = 380;
	var increase = true;
	var fb_animatioItem = null;
	var fb_animation_timeout = 100;	
	
	function fbAnimation(){
				
				//fb_animatioItem.style.height = 100+"px"				
				
		var ch = parseInt(fb_animatioItem.style.height);		
		// alert('OBJEKAT ' + fb_animatioItem + " HEIGHT [" + fb_animatioItem.style.height + "] - OTHER HEIHGT [" + ch + "]");		return;
				
		if(increase){
			// make it bigger
			fb_animatioItem.style.height = height_max + "px";
			increase = false;
			return;
			
			if(ch < height_max){
				fb_animatioItem.style.height = parseInt(ch+10) + "px";
			}
			else{
			increase = false;
				if(tmr_fb){ clearTimeout(tmr_fb); }
				return;
			}			
		}
		else{
			// make it smaller
			fb_animatioItem.style.height = height_min + "px";
			increase = true;
			return;
			
			if(ch > height_min){
				fb_animatioItem.style.height = parseInt(ch-10) +"px";
			}
			else{
				increase = true;				
				if(tmr_fb){ clearTimeout(tmr_fb); }				
				return;
			}
						
		}		
			//
			tmr_fb = setTimeout("fbAnimation()", fb_animation_timeout);
	}
	
	function init_fbAnimation(id, timeout, height, increase){
	
		fb_animatioItem = document.getElementById(id);				
		fb_animation_timeout = timeout;		
		
		if((fb_animatioItem.style.height).length == 0){
			fb_animatioItem.style.height = height + "px";
		}		
		
			 fbAnimation();
	}	

// FB **** /

