var jQue = jQuery.noConflict();

function rand (n) {
	return ( Math.floor(Math.random() * n + 1));
}

function testimonyPicker() {
var testiNumber = rand(7);
	jQue('#testi_0'+testiNumber).css('visibility', 'visible');
}

function adPicker() {
var testiNumber = rand(3);
	jQue('#testi_0'+testiNumber).css('visibility', 'visible');
}

function GRScroller() {
setInterval(function() {
	var scrollPosition = jQue('.rotItem:last-child').position().left;
	var scrollerLength = jQue('#roScroller').children().length;
	var scrollAction = jQue('.rotItem').width();
	var scrollerMove = (scrollerLength * scrollAction) - scrollAction ;
		if(scrollPosition < 800) {
			jQue('.SCHandle').animate({marginLeft: "+="+scrollerMove+"px"}, "slow");
				}
				else {
				jQue('.SCHandle').animate({marginLeft: "-="+scrollAction+"px"}, "slow");
				}
			}, 6000);
}

function propScrollerDivs() {
	var mastCont = document.getElementById('scrollerDiv');
	var count = mastCont.getElementsByTagName('div').length;
	
	for(i = 0; i <= count; i++) {
		document.write('<li class="counter"><a onClick="">'+i+'</a></li>');
	}
}

function galControls() {
	
	jQue('.leftOver').live({click: function() {
		jQue('#galContain').fadeOut('slow', function() {
		jQue('.galSlide:first').appendTo('#galContain');
		});
		jQue('#galContain').fadeIn('slow');
		/*jQue('#teller').html(theMargin);*/
		}
	});
	
	jQue('.rightOver').live({click: function() {
		jQue('#galContain').fadeOut('slow', function() {
		jQue('.galSlide:last').prependTo('#galContain');
		});
		jQue('#galContain').fadeIn('slow');
		}
	});
}

/*contact form functions */
function stripTagz()
{
var subs= /<\S[^><]*>/g
for (i=0; i<arguments.length; i++)
arguments[i].value=arguments[i].value.replace(subs, "")
}

function verify() {
var incomplete = "All fields are required, please fill in the";
if (document.form.Name.value=="") {
incomplete = incomplete + " - Name Field";
}
if (document.form.Email.value=="") {
incomplete = incomplete + " -  Email Field";
}
if (document.form.message.value=="") {
incomplete = incomplete + " -  Text Area";
}

if (incomplete == "All fields are required, please fill in the") {
document.form.submit();
}
else {
alert(incomplete);
return false;
   }
}

							   
