

var hideDo;

function layerShow() {
	hideDo = false;
	document.getElementById('ofertaLayer').style.display = 'block';	
}


function layerHide(mode) {
	if(mode == 0) {
		hideDo = true;
		setTimeout(function() { layerHide(1); }, 500);
	}
	else if(mode == 1 && hideDo == true) {
		hideDo = false;
		document.getElementById('ofertaLayer').style.display = 'none';
	}
}


function popup(width, height, url) {
	var popup_window = window.open(url, '', 'width='+width+', height='+height+',scrollbars=yes');
}


function ddisable() {


}


/***********************************************
* Disable Text Selection script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function disableSelection(target){
	if (typeof target.onselectstart!="undefined") //IE route
		target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
		target.style.MozUserSelect="none"
	else //All other route (ie: Opera)
		target.onmousedown=function(){return false}
            
	target.style.cursor = "default"
}

//Sample usages

 //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"




var _container;
var _scrollSpeed = 9;
var _delay = 100;
var _pause = 5000;
var _elementHeight;
var _elementsCount;
var _direction = 1;
var _skipPause;

function slideshow(container, elementsCount, elementHeight) {
	_container = container;
  _elementHeight = elementHeight;
  _elementsCount = elementsCount;
  _container.style.top = '0px';
	setTimeout('scrollElement()', _pause);
}

function scrollElement() {
	_skipPause = false;
  if((parseInt(_container.style.top) * -1) > (_elementsCount -1) * _elementHeight) {
  	//_container.style.top = _elementHeight + 'px';
    _direction = -1 
    _skipPause = true;
  }

  if(parseInt(_container.style.top) > 0 && _direction == -1) {
    _direction = 1 
    _skipPause = true;
  }
  
  _container.style.top = (parseInt(_container.style.top) - (_direction * _scrollSpeed)) + 'px';
  if(parseInt(_container.style.top) % _elementHeight == 0 && _skipPause == false) {
  	setTimeout('scrollElement()', _pause);
  }
	else {
  	setTimeout('scrollElement()', _delay);
  }
}

var _dehover = 0;
var _obj;
function ieHover(obj, mode) {
	if(navigator.userAgent.indexOf('MSIE') < 0) return;
	if(mode == 1) {
    _dehover = 0;  
  	if(obj.className.indexOf('hover') > 0) return;
  	obj.className += ' hover';
  }
  else {
  	_dehover = 1;
    _obj = obj;
		setTimeout('dehoverDo()', 100);
  }
}

function dehoverDo() {
	if(_dehover == 1) {
  	_obj.className = _obj.className.replace(/ hover/, '');
  }
}

function activate(elem) {
	elem.className = 'active';
}

function de_activate(elem) {
	elem.className = '';
}



var _ssGalleryImage;
var _ssGalleryScollSpeed = 14;
var _ssGalleryDirection = 1;
var _ssGalleryIsScrolling = 0;
var _ssTL;
var _ssThumbWidth = 100; // width margins etc.
var _ssImgWidth = 495;



function ssGallery() {
	if(_ssGalleryImages.length == 0) return;
  _ssTL = document.getElementById('ssThumbnailsLayer');

  for(var i = 0 ; i < _ssGalleryImages.length ; i++) {
  	var _a = document.createElement('A');
    _a.href = 'javascript:ssGalleryShow('+i+');';
    var _img = document.createElement('IMG');
    _img.src = _ssGalleryImages[i][0];
    _img.title = _ssGalleryImages[i][4];
    _img.style.margin = '4px 0px 4px 0px';
    _a.appendChild(_img);
    document.getElementById('ssThumbnailsLayer').appendChild(_a);
  }
}

function ssGalleryShow(element_id) {
  window.open(_ssGalleryImages[element_id][1]);
}

function ssGalleryScroll(direction) {    
  _ssGalleryIsScrolling = 1;
	_ssGalleryDirection = direction;    
 	ssGalleryScrollDo();
}

function ssGalleryScrollStop() {
	_ssGalleryIsScrolling = 0;
}

function ssGalleryScrollDo() {  	
	if(_ssGalleryIsScrolling) {
  	if(!_ssTL.style.top) {
  		var top = 0;
    }
    else {
  		var top = parseInt(_ssTL.style.top);  
    }    
    top += (_ssGalleryDirection * _ssGalleryScollSpeed);
    
    if(top < (_ssThumbWidth * (_ssGalleryImages.length -2) * -1)) {
    	return;
    }
    if(top > 0) {
    	return;
    }
    _ssTL.style.top = top + 'px';
    setTimeout('ssGalleryScrollDo()', 100);
  }
}