
$(document).ready(function(){
	if ($.browser.msie && $.browser.version == 6) {
		$('img.png').ifixpng();
	}

	$('.auth .show').toggle(function(){
		$(this).addClass('active');
		$('.auth .form').show();
	}, function(){
		$(this).removeClass('active');
		$('.auth .form').hide();
	});

	$('.auth .form .close').click(function(){$('.auth .show').click();});

	$('#menu li a').hover(function(){
		$(this).parent().addClass('hover');

	}, function(){
		$(this).parent().removeClass('hover');
	});

	try {

		$(".cities a[rel='fancy']").each(function(){
			//var aname = $(this).html();
			$(this).fancybox({
				zoomSpeedOut: 500,
				zoomSpeedIn: 500,
				overlayColor: '#4a2d18',
				overlayOpacity:'0.7',
				padding: 30,
				frameHeight: $(this).next('.fancy-content').height()-40,
				hideOnContentClick: false
			}).click(function(){
				/*var aname = $(this).html();
				$('.point:contains(' + aname + ')').addClass('hover');
				return false;*/
			});
		});

		$("a[rel='fancy-subscribe']").fancybox({
			zoomSpeedOut: 200,
			zoomSpeedIn: 200,
			overlayColor: '#4a2d18',
			overlayOpacity:'0.7',
			hideOnContentClick: false,
			padding: 30,
			frameWidth:450,
			frameHeight:150
		});
		$("a[rel='fancy-register']").fancybox({
			zoomSpeedOut: 200,
			zoomSpeedIn: 200,
			overlayColor: '#4a2d18',
			overlayOpacity:'0.7',
			hideOnContentClick: false,
			padding: 30,
			frameWidth:450,
			frameHeight:300
		});


		//var presentItems = ['/images/presentation/present-pic-1.jpg','/images/presentation/present-pic-2.jpg'];
		//var itemT = {href: '/images/presentation/present-pic-1.jpg', title: ''};
		//presentItems.push(itemT);

		var presentItems = [
					{href: '/images/presentation/present-pic-1.jpg', title: ''},
					{href: '/images/presentation/present-pic-2.jpg', title: ''},
					{href: '/images/presentation/present-pic-3.jpg', title: ''},
					{href: '/images/presentation/present-pic-4.jpg', title: ''},
					{href: '/images/presentation/present-pic-5.jpg', title: ''},
					{href: '/images/presentation/present-pic-6.jpg', title: ''},
					{href: '/images/presentation/present-pic-7.jpg', title: ''},
					{href: '/images/presentation/present-pic-8.jpg', title: ''},
					{href: '/images/presentation/present-pic-9.jpg', title: ''},
					{href: '/images/presentation/present-pic-10.jpg', title: ''},
					{href: '/images/presentation/present-pic-11.jpg', title: ''},
					{href: '/images/presentation/present-pic-12.jpg', title: ''},
					{href: '/images/presentation/present-pic-13.jpg', title: ''},
					{href: '/images/presentation/present-pic-14.jpg', title: ''},
					{href: '/images/presentation/present-pic-15.jpg', title: ''},
					{href: '/images/presentation/present-pic-16.jpg', title: ''},
					{href: '/images/presentation/present-pic-17.jpg', title: ''}
							];

		$("a[rel='fancy-present']").fancybox({
			zoomSpeedOut: 400,
			zoomSpeedIn: 400,
			overlayColor: '#4a2d18',
			overlayOpacity:'0.7',
			hideOnContentClick: false,
			padding: 30,
			frameWidth:940,
			frameHeight:650,
			itemArray: presentItems
		});

		$("a[rel='fancy']").fancybox({
			zoomSpeedOut: 500,
			zoomSpeedIn: 500,
			overlayColor: '#4a2d18',
			overlayOpacity:'0.7',
			padding: 30
		});

		$("a[rel='fancy2']").fancybox({
			zoomSpeedOut: 500,
			zoomSpeedIn: 500,
			overlayColor: '#4a2d18',
			overlayOpacity:'0.7',
			padding: 30
		});


	} catch (e) {
	}

	$("a[rel='fancy-dub']").click(function(){
		$(this).parent().find("a[rel='fancy']").click();
		return false;
	});

	$("a[rel='fancy-dub2']").click(function(){
		$(this).parent().find("a[rel='fancy2']").click();
		return false;
	});

	$('.point').hover(function(){
		var aname = $(this).html();
		$(this).addClass('hover');
		$('.cities li a:contains(' + aname + ')').addClass('hover');
	}, function(){
		var aname = $(this).html();
		$(this).removeClass('hover');
		$('.cities li a:contains(' + aname + ')').removeClass('hover');
	}).click(function(){
		var aname = $(this).html();
		$('.cities li a:contains(' + aname + ')').click();
	});

	$('.cities li a').hover(function(){
		var aname = $(this).html();
		$('.point:contains(' + aname + ')').mouseover();
	}, function(){
		var aname = $(this).html();
		$('.point:contains(' + aname + ')').mouseout();
	});

	$('a[rel="blank"]').click(function(){
		window.open($(this).attr('href'));
		return false;
	});

	$('.print a').click(function(){
		window.open($(this).attr('href'));
		return false;
	});

});



var dateTime = new Date();


function flash_promo() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="972" height="354" id="big_promo" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="flash/big_promo.swf" /><param name="wmode" value="opaque" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="salign" value="lt" /><embed src="flash/big_promo.swf" wmode="opaque" menu="false" quality="high" salign="lt" width="972" height="354" name="big_promo" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

function flash_promo2() {
	document.write('<object type="application/x-shockwave-flash" data="/flash/products.swf?6" width="470" height="217" id="banners" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/flash/products.swf?6" /><param name="wmode" value="opaque" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="salign" value="lt" /><param name="FlashVars" value="FileXML=/flash/param.xml?'+dateTime.getTime()+'"></object>');
}

function flash_nylogo() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="364" height="128"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/flash/ny-logo.swf" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="salign" value="lt" /><embed src="/flash/ny-logo.swf" wmode="transparent" menu="false" quality="high" salign="lt" width="364" height="128" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}


function flash_antena(){

}







function str_replace(search, replace, subject, count) {

    var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
            f = [].concat(search),
            r = [].concat(replace),
            s = subject,
            ra = r instanceof Array, sa = s instanceof Array;
    s = [].concat(s);
    if (count) {
        this.window[count] = 0;
    }

    for (i=0, sl=s.length; i < sl; i++) {
        if (s[i] === '') {
            continue;
        }
        for (j=0, fl=f.length; j < fl; j++) {
            temp = s[i]+'';
            repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
            s[i] = (temp).split(f[j]).join(repl);
            if (count && s[i] !== temp) {
                this.window[count] += (temp.length-s[i].length)/f[j].length;}
        }
    }
    return sa ? s : s[0];
}



