// JavaScript Document

var $vpw;
var $vph;

if (typeof window.innerWidth != 'undefined') {
	$vpw = window.innerWidth,
	$vph = window.innerHeight
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
	$vpw = document.documentElement.clientWidth,
	$vph = document.documentElement.clientHeight
}
// older versions of IE
else {
	$vpw = document.getElementsByTagName('body')[0].clientWidth,
	$vph = document.getElementsByTagName('body')[0].clientHeight
}

//  set the speed as pixels/milisecond
var $ppms=20;
var $csh;
function scs() {
	var $fi = $('.crossSlide img:first');
	var $li = $('.crossSlide img:last');
	var $fw = $fi.width();
	var $afw = $fw+10;
	$sp = Math.round($afw*$ppms);
	$fi.animate({marginLeft:'-' + $afw + 'px'},$sp,'linear',function() {
		$fi.detach().insertAfter($li).css('margin-left','0px');scs();
	});
}

$().ready(function() {

	$csh = 620;
	// $('#page_content').prepend('<img border="0" style="position:absolute;z-index:90;margin-top:25px;" src="/images/lg_logo_overlay.png" />');
	var $csc = $('div.crossSlide').html();
	$('div.crossSlide').html('<div style="height:' + $csh + 'px;width:4000px;">' + $csc + '</div>');

	$('.crossSlide img').hover(function() {
		$(this).css('cursor','pointer');
	});
	$('.crossSlide img').click(function() {
		var $imgTitle = $(this).attr('alt');
		var $imgHref = '/portfolio/' + escape($imgTitle.toLowerCase().replace(/ /gi,"+"));
		window.location.href=$imgHref;
	});

	$('#crossSlide').css({
		'height':$csh + 'px',
		'margin':'0px'
	});

	$('.crossSlide').css({
		'height':$csh + 'px',
		'overflow':'hidden',
		'padding':'0px',
		'margin':'15px 0px'
	});
	$('.crossSlide img').unwrap().css({
		'height':($csh-20) + 'px',
		'width':'auto',
		'display':'inline',
		'border-width':'10px 5px',
		'border-style':'solid',
		'border-color':'#ffffff'
	});
	scs();
});
