onloadHooks.push(function(){
	datepick();
	advancedpopup();
	providerpopup();
	hideResource();
});

function hideResource() {
	$$('.hideThumb').addEvent('click', function(){
		var id = this.get('id');
		var myRequest = new Request.JSON({
		    method: 'get',
			url: '',
		    onSuccess: function(responseJSON) {		 
		        if(responseJSON.code == 'success') {
		        	$(id).getParent().setStyle('display','none');
		        }
		    }
		});
		myRequest.get({'eID':'kpk_feuser_hide', 'id':id});
	});
}

function advancedpopup() {
	SqueezeBox.initialize({
        size: {x: 400, y: 380},
        target: $('imagesearch_light'),
        handler: 'adopt',
        zIndex: '199',
        //onOpen: 'datepick()';
    });
	SqueezeBox.assign($$('a[rel=boxed]'));
}

function providerpopup() {
	if($('providerSearchPopup')) {
		$('providerSearchPopup').addEvent('click', function(){
			if($('providerOption').getStyle('display') == 'block') {
				$('providerOption').setStyle('display','none');
			} else {
				$('providerOption').setStyle('display','block');
			}
		});
	}
}

function datepick() {
	var startdate = new DatePicker('#searchBegin',{
		format: 'd.m.Y',
		allowEmpty: true,
	});
	var enddate = new DatePicker('#searchEnd',{
		format: 'd.m.Y',
		allowEmpty: true,
	});
	var advstartdate = new DatePicker('#advancedSearchBegin',{
		format: 'd.m.Y',
		allowEmpty: true,
	});
	var advenddate = new DatePicker('#advancedSearchEnd',{
		format: 'd.m.Y',
		allowEmpty: true,
	});
}
