/**
 * @author Bangthemes.com
 */

$jfix = jQuery.noConflict();

function bookmark(url, title) {
	if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(url, title);
	} else if(navigator.appName == "Netscape") {
		window.sidebar.addPanel(title, url, "");
	} else {
		alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	}
}


$jfix(document).ready(function() {

	booking();

	if($jfix().fancybox) {

		$jfix('a.lightbox').fancybox({
			titleShow : false
		});
		
		$jfix('div.gallery a').attr('rel','gallery_group');

		$jfix('div.gallery a').fancybox({
			titleShow : false
			//cyclic:true
		});

	}

	$jfix('ul li.widget_text').each(function() {
		if($jfix('h2', this).length > 0) {

			$jfix('div.textwidget', this).css({
				'padding' : '0 15px 15px 15px'
			})

		}
	})

	$jfix('#sidebar ul li:first,#sidebar02 ul li:first').addClass('wFirst');

	$jfix('div.girl').each(function(i) {

		$jfix(this).click(function() {
			window.location = $jfix('a.permalink', this).attr('href');
		});
		var a = $jfix('div.girlInfo', this).html();

		$jfix(this).hover(function() {

			if($jfix('em', this).length <= 0) {
				$jfix(this).prepend('<em>' + a + '</em>')
			}

			$jfix('em', this).css({
				'opacity' : '0.0'
			}).animate({
				'opacity' : '0.7'
			});

		}, function() {

			$jfix('em', this).animate({
				'opacity' : '0.0'
			}, 300, function() {
				$jfix(this).remove();
			});
		})
	});
});
function booking() {

	$jfix('a.bookme').click(function() {
		$jfix('#xform').show();
		$jfix('#thankyou').hide();
		$jfix('#booking').toggle();
	});

	$jfix("#formy").validate({
		rules : {
			email : {
				email : true
			}
		},
		submitHandler : function(form) {
			ajaxSubmit();
		}
	});

}

function ajaxSubmit() {

	var tmplUrl = $jfix('#tmplUrl').html();
	var dataString = $jfix('#formy').serialize();

	$jfix.ajax({
		type : "POST",
		url : tmplUrl + "/scripts/send.php",
		data : dataString,
		success : function() {

			$jfix('#formy')[0].reset();
			$jfix('#thankyou').slideDown();

		}
	});

}

