$(document).ready(function() {
    
    if ( typeof $('#article .faq dl dd') != 'null' ) {

        $('#article .faq dl dd').hide();    

        $('#article .faq dl dt.title a:first').click(function () {
            var p = $(this).parent().parent();
            p.children('dd').toggle();
            return false;
        });


    }

	// Input field placeholders
	$('#header .email fieldset input, #payment-type').focus(function () {
		if (typeof $(this).attr('placeholder') == 'undefined' || $(this).attr('placeholder') == $(this).val()) {
			$(this).attr('placeholder', $(this).val());
			$(this).val();
			$(this).attr('value', '');
		}
	}).blur(function () {
		if ($(this).val().length == 0) {
			$(this).attr('value', $(this).attr('placeholder'));
		}
	});
	
	// Open overlay by click
	$('a[rel="overlay"]').click(function () {
		var overlayName = $(this).attr('class');
		$('#overlay-main').show();
		$('#' + overlayName).show();
		if($.browser.msie && $.browser.version=="6.0") {
			$('#overlay-main').append('<iframe></iframe>');
		}
		//return false;
	});
	// Close overlay
	$('#overlay-main .overlay button.close').click(function () {
		$(this).parent().parent().hide();
		$('#overlay-main').hide();
		return false;
	});
	
});






// Open ovelay by function ,,
function openOverlay(overlayName, overlayMode) {
 if ( typeof(overlayMode) != "undefined")
  if ( typeof(nm.globals.overlayModeFunc) != "undefined" )
    nm.globals.overlayModeFunc(overlayMode);

 $('#overlay-main').show();
 $('#'+overlayName).show();
 if($.browser.msie && $.browser.version=="6.0") {
  $('#overlay-main').append('<iframe></iframe>');
 }
}

// Close mail selection dialog
function closeOverlay(overlayName) {
 $('#overlay-main #' + overlayName + ' .overlay button.close').trigger('click');
}

