var autoplay={	play:1,	id:0};function wait_img() {	return '<br><img src="tpl/images/indicator.gif" width=15 height=15><br><br>';}var monit_dialogs=new Array();monit_dialogs['limit']='Przekroczyles limit plikow do pobrania';var sel_MP=0;var sel_OFS=0;var sel_LIM=0;var cur_dwnl=0;function audio_monit(sid) {//	Sound.play('audio_monit/'+sid+'.mp3');}function ch_section_ofs(idsec,ofs) {	sel_OFS=ofs;	ch_section(idsec);	sel_OFS=0;	return false;}function ch_library() {	if ($('#repeBGcontent').length) {		$('#repeBGcontent').html(wait_img());		//		alert($('#jumpMenu').val());				$('#repeBGcontent').load('ax.php?op=sections_menu&id_lib='+$('#jumpMenu').val() , function() {ch_section(0)});	}	return void(0);}function bulk_recountHtmlUpdate(s1, s2, s3) {	$('#bulkcount_pckcnt').html(s1);	$('#bulkcount_fcnt').html(s2);	$('#bulkcount_scnt').html(s3);}function bulk_recount() {	$.ajax({url:'ax.php?op=bulkrecount',success:function(w) {		var warsy=w.split('|');		bulk_recountHtmlUpdate(warsy[0],warsy[1],warsy[2]);}	});}function sel_file_out(id) {	sel_file(id);	$('#selfileli['+id+']').remove();}function sel_file(id) {	$.ajax({		url:'ax.php?op=sel_file&id='+id,		success:function(msg) {			if (msg=='exceed') {				alert('You have exceeded your download limit!');				return false;			}			var warsy = msg.split('|');			if ($('#imgf_'+id)) {				if (warsy[0]=='on') {					$('#imgf_'+id).addClass('sel'); 				} else {					$('#imgf_'+id).removeClass('sel');				}			}						bulk_recountHtmlUpdate(warsy[1],warsy[2],warsy[3]);					}	});		return false;}function select_all() {	if ($('#thissiteids').length) {		var tmp = $('#thissiteids').val().split(',');		if (tmp.length>0) {			for (i=0; i<tmp.length; i++) {				if (tmp[i]!='') $('#imgf_'+tmp[i]).addClass('sel');			}			$.ajax({				url:'ax.php?op=selectall&ids='+$('#thissiteids').val(),				success:function(msg) {					var warsy = msg.split('|');					bulk_recountHtmlUpdate(warsy[0],warsy[1],warsy[2]);				}			});					}	}	return false;}function deselect_all() {	if ($('#thissiteids').length) {		var tmp = $('#thissiteids').val().split(',');		if (tmp.length>0) {			for (i=0; i<tmp.length; i++) {				if (tmp[i]!='') $('#imgf_'+tmp[i]).removeClass('sel');			}			$.ajax({				url:'ax.php?op=deselectall&ids='+$('#thissiteids').val(),				success:function(resp){					var warsy = resp.split('|');					bulk_recountHtmlUpdate(warsy[0],warsy[1],warsy[2]);									}			});					}	}	return false;	}function clear_selection_out() {	clear_selection();	ch_site('currentdown');}function clear_selection() {	if ($('#thissiteids').length) {		var tmp = $('#thissiteids').val().split(',');		if (tmp.length>0) {			for (i=0; i<tmp.length; i++) {				if (tmp[i]!='') $('#imgf_'+tmp[i]).removeClass('sel');			}		}	}	$.ajax({		url:'ax.php?op=unsetall',		success:function(resp) {			var warsy = resp.split('|');			bulk_recountHtmlUpdate(warsy[0],warsy[1],warsy[2]);		}	});	}function ch_section(idsec) {	var sortorder = $('#sort_files').val();	if ($('#files_ofs').length) sel_LIM=$('#files_ofs').val();	$('#repeBGS').html(wait_img());	$('#repeBGS').load('ax.php?op=files_menu&id_sec='+idsec+'&id_lib='+$('#jumpMenu').val()+'&ofs='+sel_OFS+'&limit='+sel_LIM+'&sort='+sortorder );	return false;}function playsample(fn) {		if (autoplay.id == fn) {		autoplay.play=0;	} else {		autoplay.play=1;	}	autoplay.id=fn;			$('a.highps').removeClass('highps').addClass('normalna');	$('a#ps_'+fn).removeClass('normalna').addClass('highps');		$('#musicplayermini').load('ax.php?op=musicplayer&fn=' + fn + '&ap=' + autoplay.play );	return true;}function simpleplay(fn) {	$('#musicPlayer').load('ax.php?op=simpleplayer&fn='+fn, function() {		$('#musicPlayer').show();		$('#hp['+fn+']').attr('src','images/listenBtn_on.png');		sel_MP=fn;	});}function ch_site(sid) {	if ($('#files_ofs').length) sel_LIM=$('#files_ofs').val();	if ($('repeBGS').length) {		$('repeBGS').html(wait_img());	}	$('#repeBGS').load('ax.php?op=getsite&sid='+sid+'&ofs='+sel_OFS+'&limit='+sel_LIM);	return void(0);}function ch_site_ofs(sid, ofs) {	sel_OFS=ofs;	ch_site(sid);	sel_OFS=0;	return false;}function get_left_sr(q) {	$('#repeBGcontent').html(wait_img());	$('#repeBGcontent').load('ax.php?op=left_search&q='+escape(q), function(){		get_content_sr($('#firstlib').val(), $('#firstsec').val());	});	return false;}function get_new_files() {	$('#repeBGcontent').html(wait_img());	$('#repeBGcontent').load('ax.php?op=newfiles', function() {//		get_content_new_files($('firstlib').val(), $('firstsec').val());	});	return false;}function get_content_new_files(idlib, idsec) {	$('#repeBGS').html(wait_img());	$('#repeBGS').load('ax.php?op=right_newfiles&idlib='+idlib+'&idsec='+idsec);	return false;}function get_content_sr(idlib, idsec) {	$('#repeBGS').html(wait_img());	$('#repeBGS').load('ax.php?op=content_search&idlib='+idlib+'&idsec='+idsec+'&q='+escape($('#qstring').val()));	return false;}function get_search_result() {	if ($('#libSearch_input').val().length>=3) {		$('#jumpMenu').hide();		get_left_sr($('#libSearch_input').val());	} else alert('Minimum 3 characters!');		return false;}function get_download_exceed() {	if ($('#download_remaining').length) {		$.ajax({			'url':'ax.php?op=download_exceed',			success:function(resp){//				alert(resp);				$('#download_remaining').val(resp);			}		});	}}function get_file(id) {	get_download_exceed();	if (($('#download_remaining').length && parseInt($('#download_remaining').val())>0) || !$('#download_remaining').length) {		$('#SampleLib'+id).html('Downloading...');		location.href='download.php?id='+id;	} else {		alert('You have exceeded your download limit!');	}}function cf_submit() {	if ($('#cf_message').val()=='') {		alert('Message is Required Field');		return false;	}	var $cftitle=$('#cf_title').val();	var $cfmessage=$('#cf_message').val();	var $cfphone=$('#cf_phone').val();	$('#repeBGS').html(wait_img());		$('#repeBGS').load('ax.php?op=cf_send&cf_title='+escape($cftitle)+'&cf_phone'+escape($cfphone)+'&cf_message='+escape($cfmessage));	return false;	}function generatePackagesFromCS() {	$('#repeBGS').html(wait_img());	$.ajax({		url:'ax.php?op=getsite&sid=generatepackagefromcs',		success:function(resp) {			$('#repeBGS').html(resp);			bulk_recount();			if ($('#onstart').length) {				var s=$('#onstart').val().split(',');				generatezipfile(s[0],s[1]);			}					}	});	}function generatezipfile(pack, part) {	$('#wait_'+pack+'_'+part).show();		$.ajax({		url:'ax.php?op=generatezipfile&pack='+pack+'&part='+part,		success:function(resp){			if (resp=='') {				alert('Server not responding');				return false;			}			var resp2=resp.split('|');			if (resp2[0]=='ok') {				$('#wait_'+pack+'_'+part).hide();				$('#dwnlbtn_'+pack+'_'+part).show();				$('#delbtn_'+pack+'_'+part).show();				// $('#delbtn_'+pack+'_'+part).click(function() {				// 	deletezipfile(pack, part);				// 	return false;				// });				// $('#dwnlbtn_'+pack+'_'+part).click(function () {				// 	location.href=resp2[1];				// 	return false;				// });			}			if (resp2[0]=='error') alert(resp2[1]);					}	});		return false;}function deletezipfile(pack, part) {	if (confirm('Are you sure?')) {		$('#wait_'+pack+'_'+part).show();		$('#delbtn_'+pack+'_'+part).hide();		$('#dwnlbtn_'+pack+'_'+part).hide();		$.ajax({			url:'ax.php',			async:false,			data:({				op:'deletezipfile',				'pack':parseInt(pack),				'part':parseInt(part)			}),			success:function(resp){									if (resp=='') {						alert('Server not responding');						return false;					}					var resp2=resp.split('|');					if (resp2[3]=='nofile') {							if (parseInt(resp2[1])!=pack) {								$('#package_'+pack).fadeOut();							} else {								$('#package_'+pack+'_'+part).fadeOut();							}						return false;					}					if (resp2[0]=='ok') {						$('#wait_'+pack+'_'+part).hide();						$('#dwnlbtn_'+pack+'_'+part).hide();						$('#delbtn_'+pack+'_'+part).hide();						if (resp2[1]!='' && resp2[2]!='') {							$('#activeparts_'+resp2[1]+'_'+resp2[2]).css('color','#ffffff');							$('#package_'+resp2[1]+'_'+resp2[2]).css('color','#ffffff');							$('#queued_'+resp2[1]+'_'+resp2[2]).hide();							if (parseInt(resp2[1])!=pack) {								$('#package_'+pack).fadeOut();							} else {								$('#package_'+pack+'_'+part).fadeOut();							}//							alert(resp2[3]);							if (resp2[3]!='nofile') generatezipfile(resp2[1], resp2[2]);						} else {							$('#package_'+pack).fadeOut();							$('#repeBGS').html('<p>You dont have any packages</p>');						}					}					if (resp2[0]=='error') alert(resp2[1]);				}							});	}	return false;}function check_uploadform() {	if ($('#upload_filefield').val()=='') {		alert('Select file from your computer');		return false;	}	if ($('#upload_title').val()=='') {		alert('Fill title field');		return false;	}	if ($('#description').val()=='') {		alert('Fill description field')		return false;	}	if ($('#keywords').val()=='') {		alert('Fill keywords field')		return false;	}	if (!$('#upload_acceptance:').is(':checked')) {		alert('You have to accept the terms and conditions');		return false;	}		return true;}function ud_highlight(el, nclass) {	$('#userdata_catlist a').removeClass('selection_selected').removeClass('pack_selected').removeClass('account_selected');	$(el).addClass(nclass+'_selected');}function upload_switch_submit() {	if ($('#upload_acceptance').is(':checked')) {		$('#submit_upload').removeAttr('disabled');	} else {		$('submit_upload').attr('disabled','disabled');	}}
