DD_roundies.addRule('#utility-bar', '0px 0px 7px 7px', true);
DD_roundies.addRule('#breadcrumb', '6px', true);
DD_roundies.addRule('#sidebar li li.first', '6px 6px 0 0', true);
DD_roundies.addRule('#sidebar li li.last', '0 0 6px 6px', true);

/*
DD_roundies.addRule('#sidebar li li a', '0', true);
DD_roundies.addRule('#sidebar > li > a', '6px', true);
*/

$(function() {
	//Documentation located in special.docs.js

	$('.uncheck-all').click(function () {
		$("ul#filter-list input[type=checkbox]").each(function()
		{
			this.checked = '';
		});
		return false;
	});

	//Operation Modals
	$('.pms-inner-wrapper li').each(function() {
		$(this).click(function() {
			var id = $(this).attr('id');
			
			$("#modal-"+id).show();
			
		});
		
	});
	
	$("#modal-wrapper").jqm({
		trigger:$('.pms-inner-wrapper li').not("#mobile"),
		closeClass:'modal-close',
		onHide:	function() {
				$(".jqmOverlay").hide();
				$("#modal-wrapper").hide();
				$(".modal-content-wrapper").hide();
			}
		}
	);
	
	$(".pms-inner-wrapper li#mobile").click(function() {
		window.location = '/mobile-hotel-solutions.php';
	});
	
	
	$(window).load(function() {
	    $('#inset-image').css('width', $('#inset-image img').width() );
	});

	$('#inset-image + h3').prev().each(function() {
	    var h = $(this).next().height()
	    $('#inset-image').css('margin-top', h+10);
	});
	
	$('#synexis-map').flash({
		swf:"/flash/global_map.swf",
		width:686,
		height:445,
		wmode:"transparent"
	});


    /*
    $('#content-wrapper').prepend('<h1 id="foo">loading flash..</h1>');

    setTimeout(function() {
    }, 3000);
    */

    var hash = location.hash,
	hashes = '|esitemarketing|synxis|bidstork|travelnetwork|media|';

	var re = new RegExp(hash + '\|');
	var openFn = function( hash ) {	
		var height = $(hash.w).height(),
			wHeight = $(window).height(),
			l = ( $(window).width() - $(hash.w).width() ) / 2,
			t = Math.max( $(window).scrollTop(), ( parseInt( $(hash.w).css('top') ) || 0 ) );
			if ( wHeight > height ) {
				var topNum = (wHeight - height) / 2;
				t+= topNum;
			}		
			$(hash.w).css({ left:l, top:t });
			hash.w.show()
	}, hideFn = function( hash ) {
		hash.o.remove()
		hash.w.hide().css({top:0,left:0})
	};
	
		$('#homepage-modal').jqm({
		onShow:openFn,
		onHide:hideFn,
		toTop:true
		}).jqmShow().jqmAddClose('.close-modal-inline').jqmAddClose('.close-modal');


	var openFnInterior = function( hash ) {
		var height = $(hash.w).height(),
		    wHeight = $(window).height(),
		    l = ( $(window).width() - $(hash.w).width() ) / 2,
		    t = Math.max( $(window).scrollTop(), ( parseInt( $(hash.w).css('top') ) || 0 ) );

		if ( wHeight > height ) {
		    var topNum = (wHeight - height) / 2;
		    t+= topNum;
		}
		$(hash.w).css({ left:l, top:t });
		hash.w.show()
	}, hideFnInterior = function( hash ) {
			hash.o.remove()
			hash.w.hide().css({top:0,left:0})
	};


	$('#interior-modal-alt').jqm({
		onShow:openFnInterior,
		onHide:hideFnInterior,
		toTop:true
	}).jqmShow().jqmAddClose('.close-modal').jqmAddClose('.btn-inline-hotel');

    $('#press-push #press-releases').each(function() {
		var current = first = $('.release', this).eq(0),
	    last = $('.release:last', this).get(0);
	
		$('#next-article').click(function(e){
			e.preventDefault();
			$(current).fadeOut('slow')
			current = ( $(current).next().length ) ? $(current).next() : $(first);
			$( current ).fadeIn('slow')
		});
    });


    var searchField = $('#search'), searchValue = $(searchField).val();
    searchField.focus(function() {
        if ( this.value == searchValue ) {
	    $(this).val('');
        }
        $(this).blur(function() {
	    if ( this.value == '' || this.value == searchValue ) {
		$(this).val('');
	    }
        });
    });

    $('input#submit').hover(function() {
	$(this).addClass('submit-hover');
    }, function() {
	$(this).removeClass('submit-hover')
    })


$('.case-study-extra').hide();
	$('a.case-study-toggle').toggle(function() {
		var el = $(this);
		el.html('Hide Details').parent().addClass('active').parent().find('.case-study-extra').slideDown('slow');
		return false;								   
	},function() { 
		var el = $(this);
		el.html('Read More');
		$('.case-study-extra').hide();
		return false;								   
	});

	$(".article-wrapper").each(function(){
		$('.article-long').hide();
		var x = $(this);
      $("a.read-more",x).toggle(function(){
           $(".article-long",x).slideDown();
           $(this).addClass(" active");
           $(this).html("Read Less");
     }, function() {
           $(".article-long",x).slideUp();
           $(this).removeClass(" active");
           $(this).html("Read More");
      });
	});
	
	if ($('body').is('.newsletter')){
		var contents = '<ul>';
		$('div.article-wrapper').each(function(i){
			$(this).attr('id','article-'+(i+1));
			contents+='<li><a href="#article-'+(i+1)+'">'+$(this).find('h3.article-title').text()+'</a></li>'; // end old
		});
		contents+='</ul>';
		$('div.inner-articles-listing').append(contents);
		
		$('.newsletter-inset').each(function(){
			$(this).find('img').parent().parent().addClass('with-image');
		});
	}
	
	$('#job-sidebar').each(function() {
		$('#request-info').remove();
	});
	
});
	$(document).ready(function() {
		setInterval ( "swoop()", 9500 ); 
	});
	function swoop() {
		$('#curvy').show();
		$('#curvy').animate({top: -441},2750, function() {
			resetSwoop();																  
		});
	}
	function resetSwoop() {
		$('#curvy').css({"top":"390px"});
		$('#curvy').hide();
	}

