// JavaScript Document
jQuery(function( $ ){
				
	


	/*var $galtop = $('#galframeload');
	
	$galtop.preload({ onFinish:function() {
					$('body').fadeIn();
					///startPage();
	} });*/
	  $('#wrapper').delay(100).fadeIn('false', function() {
        // Animation complete
		startPage();
      });


	function startPage() {
		
		var rulenum;
		var leftheight =  $("#columnone").height();
		var rightheight =  $("#columntwo").height();
		if(leftheight >= rightheight) {
			rulenum = leftheight;
		} else if(rightheight > leftheight) {
			rulenum = rightheight;
		}
		$("#homevertrule").css({ "height" : rulenum });
		
		
		var colone=$("#secondcolone").height();
		var coltwo=$("#secondcoltwo").height();
		var colthree=$("#secondcolthree").height();
		
		var highest = Math.max(colone,coltwo,colthree);

		
		  
		$("#secondvertrule1").css({ "height" : highest });
		$("#secondvertrule2").css({ "height" : highest });
		
		
		
		runGallery();		
	}
	
	/*gallery*/
	
	
	
	/*icons*/
	$(".ventureicon").hover(
  		function () {
			var ventureheight = $('#venturebalwrap').height();
			var venturepos = (0) - ventureheight;
			$("#venturebalwrap").css({ "top" : venturepos });
    		$('#venturebalwrap').stop(true,true).fadeIn(500);
  		},
  		function () {
    		$('#venturebalwrap').stop(true,true).fadeOut(50);
  		}
	);
	$(".bankingicon").hover(
  		function () {
			var bankingheight = $('#bankingbalwrap').height();
			var bankingpos = (0) - bankingheight;
			$("#bankingbalwrap").css({ "top" : bankingpos });
    		$('#bankingbalwrap').stop(true,true).fadeIn(500);
  		},
  		function () {
    		$('#bankingbalwrap').stop(true,true).fadeOut(50);
  		}
	);
	$(".eb5icon").hover(
  		function () {
			var eb5height = $('#eb5balwrap').height();
			var eb5pos = (0) - eb5height;
			$("#eb5balwrap").css({ "top" : eb5pos });
    		$('#eb5balwrap').stop(true,true).fadeIn(500);
  		},
  		function () {
    		$('#eb5balwrap').stop(true,true).fadeOut(50);
  		}
	);
	
	
	/*smallicons3*/
	$(".ventureiconsm").hover(
  		function () {
			
			$('#labels3').html('Venture Capital');
			$("#labels3").css({ "background-position" : '0px 0px' });
    		$('#labels3').stop(true,true).fadeIn(500);
			
			if(page == 'nm') {
			  $('#labels2').html('Venture Capital');
			  $("#labels2").css({ "background-position" : '0px 0px' });
			  $('#labels2').stop(true,true).fadeIn(500);
			} else if(page == 'eb') {
			  $('#labels2').html('Venture Capital');
			  $("#labels2").css({ "background-position" : '0px 0px' });
			  $('#labels2').stop(true,true).fadeIn(500);
			}
			
  		},
  		function () {
    		$('#labels3').stop(true,true).fadeOut(50);
    		$('#labels2').stop(true,true).fadeOut(50);
  		}
	);
	$(".bankingiconsm").hover(
  		function () {
			$('#labels3').html('Community Development Finance');
			$("#labels3").css({ "background-position" : '-245px 0px' });
    		$('#labels3').stop(true,true).fadeIn(500);
			
			if(page == 'vc') {
			  $('#labels2').html('Community Development Finance');
			  $("#labels2").css({ "background-position" : '0px 0px' });
			  $('#labels2').stop(true,true).fadeIn(500);
			} else if(page == 'eb') {
			  $('#labels2').html('Community Development Finance');
			  $("#labels2").css({ "background-position" : '-245px 0px' });
			  $('#labels2').stop(true,true).fadeIn(500);
			}
			
  		},
  		function () {
    		$('#labels3').stop(true,true).fadeOut(50);
    		$('#labels2').stop(true,true).fadeOut(50);
  		}
	);
	$(".eb5iconsm").hover(
  		function () {
			$('#labels3').html('Colorado Regional Center EB-5');
			$("#labels3").css({ "background-position" : '-490px 0px' });
    		$('#labels3').stop(true,true).fadeIn(500);
			
			$('#labels2').html('Colorado Regional Center EB-5');
			$("#labels2").css({ "background-position" : '-245px 0px' });
    		$('#labels2').stop(true,true).fadeIn(500);
			
  		},
  		function () {
    		$('#labels3').stop(true,true).fadeOut(50);
    		$('#labels2').stop(true,true).fadeOut(50);
  		}
	);


});

var mytimeout;
var running = true;
var curImg = 0;

numimages = 3;
	function runGallery() {
		
		var numimages = $("#galimage li").length;	
		
		if(running == true) {
			if(curImg == numimages) {
				curImg = 0;
			}

			$("#galimage").find("li").eq(curImg-1).hide();
			$("#galimage").find("li").eq(curImg).fadeIn('fast');
			
			mytimeout = setTimeout("runGallery()",6000);
							
		}
		
			curImg++;
	}
	
				

	
//runGallery();
