// JavaScript Document

$(document).ready(function() {

	$('.noscript').hide();
	// Expandable content areas
	$('.expand').hide();
	$('.expand-link').click(function (e) {
		if (e.target.tagName == 'A')
			e.preventDefault();
		$('.expand').fadeToggle();
	});

	$('.submit').change(function () {
		$(this).parents('form:first').submit();
	});
	
	$('.clicknclear').click(function() {
		$(this).attr('rel', $(this).val());
		$(this).val('');
	}).blur(function() {
		if ($(this).val().length < 1)
	$(this).val($(this).attr('rel'));
	});

	if (typeof jQuery.fn.fancybox == 'function') {
		$('a.gallery-item').fancybox();
	}

	if (typeof jQuery.fn.tippy == 'function') {
		$('.tip').tippy();
	}
}); 

jQuery.fn.fadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle'}, speed, easing, callback);
};


//flash
function RunCountdown(ts,url)
{
	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	if(!InternetExplorer){
		document.write('<embed src="/skin/flash/countdown.swf" wmode="transparent" FlashVars="ts=' + ts + '&url=' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="450" height="100"></embed>\n');
	}
	else{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" style="padding: 0;" width="450" height="100">\n');
		document.write('<param name="wmode" value="transparent">');
		document.write('<param name="movie" value="/skin/flash/countdown.swf">\n');
		document.write('<param name="quality" value="high">\n');
		document.write('<param name="FlashVars" value="ts=' + ts + '&url=' + url + '">\n');
		document.write('</object>\n');
	}
}

function RunBanner(uid, width, height)
{
	var datapath = encodeURIComponent('/service/xmlbanners.php?uid=' + uid + '&data=1');
	var configpath = encodeURIComponent('/service/xmlbanners.php?uid=' + uid + '&config=1');
	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	if(!InternetExplorer){
		document.write('<embed src="/skin/flash/rotator.swf" wmode="opaque" FlashVars="datapath=' + datapath + '&configpath=' + configpath + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>\n');
	}
	else{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" style="padding: 0;" width="' + width + '" height="' + height + '">\n');
		document.write('<param name="wmode" value="opaque">');
		document.write('<param name="movie" value="/skin/flash/rotator.swf">\n');
		document.write('<param name="quality" value="high">\n');
		document.write('<param name="FlashVars" value="datapath=' + datapath + '&configpath=' + configpath + '">\n');
		document.write('</object>\n');
	}
}

