// jQuery hint js
var $j = jQuery.noConflict();
(function ($j) {

	$j.fn.hint = function (blurClass) {
		if (!blurClass) {
			blurClass = 'blur';
		}

		return this.each(function () {
			// get jQuery version of 'this'
			var $input = $j(this),

			// capture the rest of the variable to allow for reuse
			title = $input.attr('title'),
			$form = $j(this.form),
			$win = $j(window);

			function remove() {
				if ($input.val() === title && $input.hasClass(blurClass)) {
					$input.val('').removeClass(blurClass);
				}
			}

			// only apply logic if the element has the attribute
			if (title) {
				// on blur, set value to title attr if text is blank
				$input.blur(function () {
					if (this.value === '') {
						$input.val(title).addClass(blurClass);
					}
				}).focus(remove).blur(); // now change all inputs to title

				// clear the pre-defined text when form is submitted
				$form.submit(remove);
				$win.unload(remove); // handles Firefox's autocomplete
			}
		});
	};

})(jQuery);
//jQuery hint js end


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

	//textfield hint blur event
	$j('.inp-flexible input[title!=""]').hint();
	$j('select.styled').animate({ opacity: 0.0});

	//cartbox slide

	$j(".slidebox").hide();
	/*	$j(".close a").click(function(){
	$j(this).parent().parent("li").fadeOut("slow");
	})
	*/
	$j(".toplink dd").hover( function(){
		$j(this).find("div.slidebox").fadeIn("normal");
	}, function(){
		$j(this).find("div.slidebox").fadeOut("normal");
	});

	//rollover button css added on 30-08-2010
	$j(".hover-input").hover( function(){
		$j(this).addClass("hov");
	}, function(){
		$j(this).removeClass("hov");
	});

	$j(".hover-input-big").hover( function(){
		$j(this).addClass("hov");
	}, function(){
		$j(this).removeClass("hov");
	});

	/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
	//popup button js added on 02-09-2010 (Currently deactivated on 16/11/2010)
	/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*
	window.onload = function(){

		if( document.cookie && !/(^|\s|;)shownDiv=true(;|$)/.test( document.cookie ))
		{
			
			document.cookie = 'shownDiv=true';
			$j.fn.popOpen = function(){

				popID = $j(this).attr('rel');
				popURL = $j(this).attr('href');

				query= popURL.split('?');
				dim= query[1].split('&');
				popWidth = dim[0].split('=')[1];

				$j('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="http://www.harmonylighting.co.uk/skin/frontend/broadway/broadway/images/close-popup.jpg" class="btn_close" title="Close" alt="Close" /></a>');

				var popMargTop = ($j('#' + popID).height() + 80) / 2;
				var popMargLeft = ($j('#' + popID).width() + 80) / 2;

				//Apply Margin to Popup
				$j('#' + popID).css({
				'margin-top' : -popMargTop,
				'margin-left' : -popMargLeft
				});

				//Fade in Background
				$j('body').append('<div id="fade"></div>');
				$j('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();

			};

			$j('a.poplight[href=#?w=531]').popOpen();

			$j('a.close, #fade').click( function(){
				$j('#fade , .popup_block').fadeOut();
				return false;
			});

		}

	};
*/


});

