﻿global_arr_height = new Array();
global_arr_fade = new Array();
//global_arr['test'] = false;
global_fade = false;
	function fadeFunc(id, b, e, duration){
		if (global_arr_fade[id]) global_arr_fade[id].cancel();
		var myEffect = new Fx.Morph(id, {duration: duration, transition: Fx.Transitions.Sine.easeOut, link:'cancel'});
		myEffect.start({
    		'opacity': [b,e]
		});
		global_arr_fade[id] = myEffect;
	}
	
	function slideFunc(id, slide, duration, mode){
         var mySlide = new Fx.Slide(id, {mode:mode, duration:duration, transition: Fx.Transitions.Sine.easeIn});
		 if (slide == 'in') {
			 mySlide.hide();
			 //alert('lol');
		 	 mySlide.slideIn();
		 }else{
			 mySlide.slideOut();
		 }
	}
	function widthFunc(id, widthStart, widthEnd, duration){
		 var myEffect = new Fx.Morph(id, {duration:duration, transition: Fx.Transitions.Back.easeIn});
		 myEffect.start({
    		'width': [widthStart, widthEnd]
		 });
	}
	function heightFunc(id, heightStart, heightEnd, duration){
		 var myEffect = new Fx.Morph(id, {duration:duration, transition: Fx.Transitions.Quint.easeOut});
		 myEffect.start({
    		'height': [heightStart, heightEnd]
		 });
	}
	function leftFunc(id, leftStart, leftEnd, duration){
		 var myEffect = new Fx.Morph(id, {duration:duration, transition: Fx.Transitions.Quint.easeOut});
		 myEffect.start({
    		'left': [leftStart, leftEnd]
		 });
	}
	function topFunc(id, topStart, topEnd, duration){
		 var myEffect = new Fx.Morph(id, {duration:duration, transition: Fx.Transitions.Quint.easeOut});
		 myEffect.start({
    		'top': [topStart, topEnd]
		 });
	}
	function addLoader(id, type){
		if ($chk($(id))) el = $(id);
		else el = id;
		if (type == undefined) type = 1;
		el.innerHTML = "<img src='images/loaders/" + type + ".gif' />";
	}
	function removeLoader(id){
		if (id != null){
			if ( $chk($(id)) ) $(id).innerHTML = "";
		}
	}
	
	function fuckPx(val){
		return Number(val.replace('px', ''));
	}
	
	function fuckCash(){
		dieCash = '?' + Math.random()*10;
		return (dieCash);
	}
	
	function getScreenSize(what) {
		  var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		  }
		if (what=='height') { return myHeight; }
		else { return myWidth };	
	}
	function getFolder(str){
		folder = '';
		str = str.replace('"', '');
		str = str.replace("'", '');
		too = 0;
		str = str.replace('"', '');
		str = str.replace("'", '');
		len = str.length - 1;
		for (i = len; i > 0; i--){ //works with 'url(wandru/images/img.png)' and 'url("wandru/images/img.png")'    not works with with 'url(wandru/images/img.png/)'
			if (str.charAt(i) == '/') { // 47 is slash '/'
					too = i;
					break;
					}	
			}
		folder = str.slice(0, too);
		return folder;
	}
