jQuery(document).ready(function() {
	//alert('jQuery(.modspvCities).html()= '+jQuery('.modspvCities').html());
	if (jQuery('.modspvCities').html()) {
		jQuery.fancybox({
			//'title':'test',
			'padding':15,
			'width':500,
			'height':380,
			'autoScale':false,
			'type':'iframe',
			'href':'/modules/modspvlmcenters/ajax.php?pw=modspvlmcenters_banners&action=getBanner',
		});
		/*jQuery.ajax({
			url: '/modules/modspvlmcenters/ajax.php',
			data: {pw:'modspvlmcenters_banners',action:'getBanner'},
			success: function(data, status, e) {
				if (data!=undefined && data.title!=undefined && data.message!=undefined) {
					jQuery.fancybox(data.message,{'title':data.title,'width':'500','height':'380','padding':25});
				}
			}
		});*/
	}
	jQuery(".modspvIcons").click(function() {
		jQuery.fancybox({
			//'title':'test',
			'padding':15,
			'width':500,
			//'height':380,
			'autoScale':false,
			'type':'iframe',
			'href':'/modules/modspvlmcenters/ajax.php?pw=modspvlmcenters_icons&action=getIcon&pid='+jQuery(this).attr("tagid"),
		});
		/*jQuery.ajax({
			url: '/modules/modspvlmcenters/ajax.php',
			data: {pw:'modspvlmcenters_icons',action:'getIcon',pid:jQuery(this).attr("tagid")},
			success: function(data, status, e) {
				if (data!=undefined && data.title!=undefined && data.message!=undefined) {
					jQuery.fancybox(data.message,{'title':data.title,'width':'60%','padding':25});
				}
			}
		});*/
		return false;
	});
});

function modspvlmcentersMap (w, h, pid) {
	var ww = (w!=undefined) ? w : 640 ;
	var hh = (h!=undefined) ? h : 500 ;
	var myWin = null;
	var paramString = 'resizable';
	//if (hh>500) paramString += ',scrollbars';
	paramString += ',scrollbars';
	
	var myWin = newWin ("/modules/modspvlmcenters/call_map.php?pid="+pid, 'Map', ww, hh, paramString); // menubar,status,scrollbars,
	//with (myWin.document) {
		//open();
		//writeln('<html>\n<head>\n<meta http-equiv="content-type" content="text/html; charset=windows-1251">\n<title>'+imgAlt+'</title>\n</head>');
		//write('<body onKeyPress="if(event.keyCode==13||event.keyCode==27)window.close();return false;" onClick="window.close();" ');
		//writeln('marginheight="0" marginwidth="0" bgcolor="#FFFFFF" style="margin:0;padding:0;">');
		//writeln('<img alt="Кликните мышью, нажмите ESC или ENTER, чтобы закрыть окно. " src="'+imgSource+'" style="cursor:pointer;">');
		//writeln('</body>\n</html>');
		//close();
	//}
	return false;
}

function modspvlmcenters_staff_ids(fromId,toId) {
	//alert('fromId= '+fromId+', toId= '+toId);
	var fromObj = $(fromId);
	var toObj = $(toId);
	if (toObj!=undefined && fromObj.options.length!=undefined && fromObj.options.length!=0) {
		var indexText = new Array();
		for (var i=0; i<fromObj.options.length; i++) {
			if (fromObj.options[i].selected) {
				//alert('fromObj.options['+i+'].innerHTML= '+fromObj.options[i].innerHTML+', fromObj.options['+i+'].value= '+fromObj.options[i].value);
				indexText.push(fromObj.options[i].value);
			}
		}
		toObj.value = indexText;
	}
}
