
/**
 * JS Handlers
 *
 * Author: waldemar.matlosz
 */
 jQuery(function(){
 	
	 var name_options = {
		script: "/search/video",
		varname: "?category_id="+selectedCategory+"&video_name",
		json: false,
		maxresults: 35,
		callback: function(d) {
			
		}
	};
	var as = new bsn.AutoSuggest('video_name', name_options);	
	 
	
	/**
	 * Set cookie with default video display on right click
	 *
	 * Author: waldemarm
	 */	
	$('.js_turnOnVideo').mousedown(function(e){
		if(e.button==2){	
			_setCookie('profile_default_display','video');		
		}
	});
	
	
	/**
	 * Handle the highslide video upload form 
	 *
	 * Author: waldemar.matlosz
	 */	
    $('.uploadVideo').click(function(e){
        e.preventDefault();
        e.stopPropagation();

        /** create highslide object **/
        hs.htmlExpand(this, {
            objectType: 'iframe',
            width: 670,
            objectHeight: 630,
            objectLoadTime: 'after',
            allowWidthReduction: 1,
            showCredits: false,
            dimmingOpacity: 0.70,
            align: 'center',
            preserveContent: false
        });
    });	
	 
	 
	
	
	
 });
 
 /**
 * Function which set cookie with name, value and lifetime passed as the function parameter 
 * @param 'cookieLifetime' by default is set to 365 days
 *
 * Author: waldemar.matlosz
 */
function _setCookie(cookieName, cookieValue, cookieLifetime){
		if(isNaN(cookieLifetime)){
			cookieLifetime = 365;
		}
		$.cookie(cookieName, cookieValue, {path: '/', expires: cookieLifetime });
}
