$(document).ready(function() {
	$("a.img").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition'  : 'inside',
		'overlayOpacity': 0.7,
		'autoScale': true,
		'autoDimensions':true,

		'margin': '20px 0 20px 0',
		
		'overlayColor'	:'#000'
	});
	
	
	$('#gMap').each(function(){
		if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("gMap"));
		var isbizPosition = new GLatLng(55.799145,37.609);
		map.setCenter(isbizPosition, 14);
		var isbizIcon = new GIcon();
		isbizIcon.iconSize = new GSize(20, 20);
		isbizIcon.shadowSize = new GSize(23, 22);
		isbizIcon.iconAnchor = new GPoint(10, 10);
		isbizIcon.infoWindowAnchor = new GPoint(10, 12);
		isbizIcon.infoShadowAnchor = new GPoint(18, 25);
		isbizIcon.image =  'http://isbiz-agency.ru/img/gMap/isbizLeaf.png';
		isbizIcon.shadow = 'http://isbiz-agency.ru/img/gMap/isbizLeafShadow.png';
		var marker = new GMarker(isbizPosition,isbizIcon);
		map.addOverlay(marker);
		var opts = {};
		opts.maxWidth = 350;
		marker.openInfoWindowHtml("<b>Интернет-агентство ISBIZ</b><br />127018, г.Москва, 1-й Стрелецкий пер., д.16<br /><br /><img src=\"/img/gMap/best.jpg\" alt=\"\" height=\"167\" width=\"333\" /><br />",opts);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml("<b>Интернет-агентство ISBIZ</b><br />127018, г.Москва, 1-й Стрелецкий пер., д.16<br /><br /><img src=\"/img/gMap/best.jpg\" height=\"167\" width=\"333\" alt=\"\" /><br />",opts);
		});
		map.enableScrollWheelZoom();
		map.enableContinuousZoom();
		map.addControl(new GSmallMapControl());
	    map.addControl(new GMapTypeControl());
	}
	})
	
});

/*
function showHidden(N) {
	if(N.indexOf('small')>-1) {	
		document.getElementById('pic'+N.substring(5)).style.display="block";
		document.getElementById('leftCol').style.display="none";
		document.getElementById('rightCol').style.display="none";
	} else {
		document.getElementById('pic'+N.substring(3)).style.display="none";
		document.getElementById('leftCol').style.display="block";
		document.getElementById('rightCol').style.display="block";
	}
}

function $(id) {
	return document.getElementById(id) || false;
}

function addEvent(el, evnt, func){
   if (el.addEventListener) {
      el.addEventListener(evnt.substr(2).toLowerCase(), func, false);
   } else if (el.attachEvent) {
      el.attachEvent(evnt.toLowerCase(), func);
   } else {
      el[evnt] = func
   }
}
/*

addEvent(window,'onload',gMapInit);

function gMapInit() {
	if(!$('gMap')) return false;
	addEvent(window,'onunload',GUnload);
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("gMap"));
		var isbizPosition = new GLatLng(55.799145,37.609);
		map.setCenter(isbizPosition, 14);
		var isbizIcon = new GIcon();
		isbizIcon.iconSize = new GSize(20, 20);
		isbizIcon.shadowSize = new GSize(23, 22);
		isbizIcon.iconAnchor = new GPoint(10, 10);
		isbizIcon.infoWindowAnchor = new GPoint(10, 12);
		isbizIcon.infoShadowAnchor = new GPoint(18, 25);
		isbizIcon.image =  'http://isbiz-agency.ru/img/gMap/isbizLeaf.png';
		isbizIcon.shadow = 'http://isbiz-agency.ru/img/gMap/isbizLeafShadow.png';
		var marker = new GMarker(isbizPosition,isbizIcon);
		map.addOverlay(marker);
		var opts = {};
		opts.maxWidth = 350;
		marker.openInfoWindowHtml("<b>Интернет-агентство ISBIZ</b><br />127018, г.Москва, 1-й Стрелецкий пер., д.16<br /><br /><img src=\"/img/gMap/best.jpg\" alt=\"\" height=\"167\" width=\"333\" /><br />",opts);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml("<b>Интернет-агентство ISBIZ</b><br />127018, г.Москва, 1-й Стрелецкий пер., д.16<br /><br /><img src=\"/img/gMap/best.jpg\" height=\"167\" width=\"333\" alt=\"\" /><br />",opts);
		});
		map.enableScrollWheelZoom();
		map.enableContinuousZoom();
		map.addControl(new GSmallMapControl());
	    map.addControl(new GMapTypeControl());
	}
}

*/


function check_feedback(){

	bCheck = 0;
	
	if(document.getElementById('fname').value == ''){

		//ShowDiv('errDiv');
		//document.getElementById('errText').innerHTML='Не заполнено поле "Ваше имя"';
		alert('Не заполнено поле "Ваше имя"');
		return false;
	}

	if(document.getElementById('fmail').value == ''){

		//ShowDiv('errDiv');
		//document.getElementById('errText').innerHTML='Не заполнено поле "E-mail"';
		alert('Не заполнено поле "E-mail"');
		return false;
	}

	pattern = new RegExp('^[_\.0-9A-Za-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]', 'g');
		if(!pattern.test(document.getElementById('fmail').value)){
		//ShowDiv('errDiv');
		//document.getElementById('errText').innerHTML='Не корректно заполнено поле "E-mail"';
		alert('Не корректно заполнено поле "E-mail"');
		return false;
	}
	
	if(document.getElementById("antispam").getElementsByTagName("input").item(0).value != (value1 + value2)) {
		alert('Не верно подсчитано значение: '+expression.textContent+document.getElementById("antispam").getElementsByTagName("input").item(0).value);
		return false;
	}
	
	document.getElementById('check_test_form').submit()
}



function ShowDiv(id){
		document.getElementById(id).style.display = 'block'

}

function HideDiv(id){
		document.getElementById(id).style.display = 'none'
}
function HideLoad(id){
	document.getElementById(id).style.display = 'none';
}
function LightTr(id){
	document.getElementById(id).className = 'light_but';
}
function DisLightTr(id){
	document.getElementById(id).className = 'dis_light_but';
}
function LightTrT(id){
	document.getElementById(id).className = 'light_tr';
}
function DisLightTrT(id){
	document.getElementById(id).className = 'dis_light_tr';
}
