$(document).ready( function() {
	var ad_div = $('#screen');
	var height = ad_div.height();
	var opened = false;
 	ad_div.hide().css({ height : 1 });
	
	function changePic(el, pic1, pic2) {
		var pic=((el.src.match(pic1)!=null)? pic2 : pic1);
		el.src="images/int-ext-rollovers/"+pic+".jpg";
	}
	
	var pic = $('#colors-change');
	pic.click( function(){
		if(opened == false)
			changePic(this,'int-ext-colors-open','int-ext-colors');
	});
	
	pic.hover( function(){
		if(opened == false)
			changePic(this,'int-ext-colors-hover','int-ext-colors');
	});
	

	$('#screen_link').click(function () {
			if( opened === false ) {
				ad_div.show().animate({ height : height }, { duration: 700 });
				opened = true;
			}
			return false;
	});
	
	$('#screen_hide_link').click(function() {
		opened = false;		
		ad_div.animate({ height: 1 }, { duration: 700, complete: function () { ad_div.hide();} });	
		var pic=document.getElementById('colors-change');
		{changePic(pic,'int-ext-colors-open','int-ext-colors');}
		return false;
	});
});
