function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function build_lnk(obj, ref){
   obj.href = ref;
}

function popupWindow(sScript, sName, iWidth, iHeight) {
	var x = (640 - iWidth)/2;
	var y = (480 - iHeight)/2;

	if (screen) {
		y = (screen.availHeight - iHeight)/2;
		x = (screen.availWidth - iWidth)/2;
	}

	var oWin=window.open(sScript, sName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+iWidth+',height='+iHeight+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
	oWin.focus();
	return oWin;
}

function popupErrorSC(iD) {
	popupWindow(Offset+"/sc_report.php?id_center="+iD+"&type=E","complaint"+iD,620,645);
}

function popupReportSC(iD) {
	popupWindow(Offset+"/sc_report.php?id_center="+iD+"&type=R","report"+iD,620,570);
}

function popupRequestSC(iD) {
	popupWindow(Offset+"/sc_request.php?id_center="+iD,"request"+iD,620,570);
}

function popupOrderSC(iD) {
	popupWindow(Offset+"/sc_view_order.php?id_center="+iD,"order"+iD,620,460);
}

function popupMarkSC(iD) {
	popupWindow(Offset+"/sc_mark.php?id_center="+iD,"mark"+iD,620,590);
}

function switchOnOption(idHiddenField, returnVar) {
	result = false;
	field = document.getElementById(idHiddenField);
	if (field) {
		if (field.style.display == '') {
			field.style.display = 'none';
			result = false;
		}
		else {
			field.style.display = '';
			result = true;
		}
	}
	if (returnVar=="0") result = false;
	return(result);
}

function Show_Request_Form(request_type) {
	//$('#user_login_div').modal({minHeight:600, minWidth: 400, close:true, position:[120,'61%']});
	//*
	document.frm_request.report_type.value=request_type;
	$('#user_request_div').modal({
		minHeight:0, 
		minWidth: 0, 
		close:true,
		position: ["50"]
	});
	//*/
	//jQuery('#user_request_div').toggle();
	//return false;
}

function Show_Comment_Form(id)
{	
	Remove_Comment_Form();
	
	form = $('#request_blank').html();
	form = form.replace(/\:\:id_parent\:\:/g, id);
	
	$(form).appendTo("#answer_block_"+id);
	
	$("#user_request_div_"+id).attr("name", "user_request_div");
	$("#user_request_div_"+id).show();
	$("#request_message_"+id).focus();
}

function Remove_Comment_Form() {
	if (prom = $("div[name='user_request_div']").attr("id")) 
	{
		id = prom.match(/[0-9]+/g);
		$('#'+prom).remove();
		$('#'+id).show();
	}
return false;
}

