// JavaScript Document
/*if (is_ie6 && document.all && document.styleSheets && document.styleSheets[0] && document.styleSheets[0].addRule)
{
	document.write("<link rel='stylesheet' type='text/css' href='css/ie6fixes.css' />");
	document.styleSheets[0].addRule('*', 'behavior: url(/_repository/drs/css/iepngfix.htc)');
}
*/

var Thumbs = {
	Start: function () {
		
		//Thumbs.BrowserWidth();
		
		$('#right_inner img').css( 'width', '95px');
		$('#right_inner img').css( 'height', '82px');
	
		if  ($( '#mainPic img' ).width() < $( '#mainPic img' ).height() )
		{
			$('#mainPic img' ).addClass('portrait');
			$('#mainPic img').css('width', '305px');
			$('#mainPic img').css('height', '410px');
		} else {
			$( '#mainPic img' ).addClass('portrait');
			$('#mainPic img').css('width', '410px');
			$('#mainPic img').css('height', '305px');
		}
	
		$('div.thumbs img').each( function() { 	
			if( $(this).height() < $(this).width()) { // landscape
				$(this).removeClass('portrait');
				$(this).addClass('landscape');
				$(this).css('width', '100px');
				$(this).css('height', '69px');
			} else { // portrait
				$(this).css('width', '70px');
				$(this).css('height', '69px');
				$(this).removeClass('landscape');
				$(this).addClass('portrait');
			}
			$(this).click(function() {
				$('#mainPic img').attr('src', $(this).attr('src'));
				if ($(this).css('height') > $(this).css('width') ) { //lanscape
					$('#mainPic img').removeClass('portrait');
					$('#mainPic img').addClass('landscape');
					$('#mainPic img').css('width', '410px');
					$('#mainPic img').css('height', '305px');
				} else {//portrait
					$('#mainPic img').removeClass('landscape');
					$('#mainPic img').addClass('portrait');
					$('#mainPic img').css('width', '305px');
					$('#mainPic img').css('height', '410px');
				}
			});
		});
	},

	BrowserWidth: function() {
							if (is_ie6)
							{
								$('div#right').css("height","1%");
								//document.getElementById('right').currentStyle.hasLayout = true;
							}

							var clientW = $(document).width();
							
							if ( clientW > 750 && clientW < 800 )
							{
								$('head').append("<style type='text/css'>#content { width:23%; }</style>");
							}
							else if ( clientW > 801 && clientW < 1199 )
							{
								$('head').append("<style type='text/css'>#content { width:41%; }</style>");
							}
							else if ( clientW > 1200 && clientW < 1499 )
							{
								$('head').append("<style type='text/css'>#content { width:53%; }</style>");
							}
							else if ( clientW > 1500 )
							{
								$('head').append("<style type='text/css'>#content { width:62%; }</style>");
							}
							
	}

}

$( document ).ready ( Thumbs.Start );


