$(document).ready(function(){
	
	// contact form ************************************************************
	var _contuctUs = $('a.contuct-us');
	var _contactForm = $('#header .contact-bar');
	_contuctUs.data('open', false);
	_contuctUs.click(function(){
		if (!_contuctUs.data('open')) {
			_contuctUs.data('open', true);
			_contactForm.animate({marginTop:0},{queue:false, duration:600});
		} else {
			_contuctUs.data('open', false);
			_contactForm.animate({marginTop:-177},{queue:false, duration:600});
		}
		return false;
	});
	
	// hide form text **********************************************************
	hideFormText();
	
	// accordion ***************************************************************
	if (typeof $().accordion == 'function') {
		$('.news-list').accordion({
			autoHeight: false,
			collapsible: true,
			active: '.selected'
		});
	}
	
	// tabslide ****************************************************************
	if (typeof $().slideNews == 'function') {
		$('div.slide-box').slideNews({
			btNext:'a.next',
			btPrev:'a.prev',
			tabsNews:'div.buttons a',
			holderList: 'div.slide-show',
			scrollElParent: 'ul',
			scrollEl: 'li',
			autoSlide: false
		});
	}
	
});

// hide form text **************************************************************
function hideFormText() {
	var _inputs = document.getElementsByTagName('input');
	var _txt = document.getElementsByTagName('textarea');
	var _value = [];
	
	if (_inputs) {
		for(var i=0; i<_inputs.length; i++) {
			if (_inputs[i].type == 'text' || _inputs[i].type == 'password') {
				
				_inputs[i].index = i;
				_value[i] = _inputs[i].value;
				
				_inputs[i].onfocus = function(){
					if (this.value == _value[this.index])
						this.value = '';
				}
				_inputs[i].onblur = function(){
					if (this.value == '')
						this.value = _value[this.index];
				}
			}
		}
	}
	if (_txt) {
		for(var i=0; i<_txt.length; i++) {
			_txt[i].index = i;
			_value['txt'+i] = _txt[i].value;
			
			_txt[i].onfocus = function(){
				if (this.value == _value['txt'+this.index])
					this.value = '';
			}
			_txt[i].onblur = function(){
				if (this.value == '')
					this.value = _value['txt'+this.index];
			}
		}
	}
}
