$(document).ready(function(){
	var resizeTimer = null;
	$(window).bind('resize', function() {
		if (resizeTimer) clearTimeout(resizeTimer);
		resizeTimer = setTimeout(doSomething, 100);
	});
	
	var w = ($(window).width() - 1001)/2;
	if (w > 1){
		$(".keybox").show();
		$(".keybox").css("width",w);
	}
	else
		$(".keybox").hide();
});

function doSomething() {
	var w = ($(window).width() - 1001)/2;
	
	if (w > 1){
		$(".keybox").show();
		$(".keybox").css("width",w);
	}
	else
		$(".keybox").hide();
};

function imgpop(table,imgid)
{

	var url = "imgpop.php?tbl="+table+"&id="+imgid;
	
	ajax_req("GET",url+'&bustcache='+new Date().getTime(),"imgpop_done");
}

function imgpop_done(){

	var d = document.getElementById('imgpop');
	
	if (ajax.readyState == 4) {
		var responce = ajax.responseText.split('|');
		
		d.innerHTML = '<img class="html_image" alt="'+responce[0]+'" src="uplds/services/m-'+responce[1]+'"><div class="service"><div class="title">'+responce[0]+'</div><div class="html">'+responce[2]+'</div></div>';
	}
}

function render_pdf(url){
	$("#pdf_iframe").show();
	$("#pdf_iframe_hide").show();
	document.getElementById('pdf_iframe').src=url;
}