
$(document).ready(function() {
	checkForSound();
	$.history.init(toggleHomeContent);
	$("div[rel='history']").click(function(){
		var hash = $(this).attr('name');
		$.history.load(hash);
		return false;
	});
	$("a[rel='history']").click(function(){
		var hash = this.href;
		hash = hash.replace(/^.*#/, '');
		$.history.load(hash);
		return false;
	});
	shortcut.add("H",function() { if($(window).scrollTop() > 50) { window.scrollTo(0, 50); doscroll(0,getScrollHeight(),0);}},{ 'type':'keydown', 'disable_in_input':true, 'keycode':72 });
	shortcut.add("J",function() { moveto('next'); },{ 'type':'keydown', 'disable_in_input':true, 'keycode':74 });
	shortcut.add("K",function() { moveto('prev'); },{ 'type':'keydown', 'disable_in_input':true, 'keycode':75 });
	
	$("#submit_application").live("click", function() { submitApplication(); });
	
	var ie7 = $.browser.msie && /MSIE 7.0/.test(navigator.userAgent);
	if(ie7) $("body").addClass("ie7");
	
	$("#search_form .search").focus(function() {
        if($(this).val() == $(this).attr("rel")) $(this).val("");
    }).blur(function() {
        if($(this).val() == "") $(this).val($(this).attr("rel"));
    }).blur();
    
    if($(".slideshow_wrapper_preview").length > 0) {
    	startSlideshow('preview');
    }
});
///////////////////////////////////////////////////////////////////////////////////////////////////
var imgWallLoop = "";
$(window).load(function() {
	$("#home_logo").addClass("logo_loaded");
	$("#logo_img_loader").hide();
	$(".home_gallery_content #img_wall img").show();
	$(".nav_logo").live("mouseenter", function() {
		$(".nav_logo #img_wall").css("visibility", "visible");
    	imgWallLoop = setInterval(imgWall, 75);
	});
	$(".nav_logo").live("mouseleave", function() {
		clearInterval(imgWallLoop);
		imgWallLoop = "";
		$(".nav_logo #img_wall").css("visibility", "hidden");
	});
	$(".wall_img").each(function() {
		var height = $("img", this).height();
		var width = $("img", this).width();
		
		if(height != 134 || width != 200) {
			$(this).remove();
		}
	});
});
///////////////////////////////////////////////////////////////////////////////////////////////////
function imgWall() {
	$(".nav_logo #img_wall .wall_img:first").show().next(".wall_img").hide().end().appendTo(".nav_logo #img_wall");
}
///////////////////////////////////////////////////////////////////////////////////////////////////
function startSlideshow_network(pid) {
	var elements = document.getElementsByClassName("slideshow_container_"+pid);
	var template = $("#template").val();
	var design = $("#design").val();
	if(design) {
		var isSC = template.indexOf("spacecollective") >= 0 ? true : false;
		var isOz = design.indexOf("ozfeed") >= 0 ? true : false;
	} else {
		var isSC = false, isOz = false;
	}
	if(elements) {
		var el_prev = document.getElementsByClassName("slide_prev_"+pid);
		var el_next = document.getElementsByClassName("slide_next_"+pid);
		var el_count = document.getElementsByClassName("slideshow_count_"+pid);
		var el_nav = document.getElementsByClassName("slideshow_nav_"+pid);
		var el_wrapper = document.getElementsByClassName("slideshow_wrapper_"+pid);
		var el_slideclick = document.getElementsByClassName("slideclick_"+pid);
		var el_caption = document.getElementsByClassName("slideshow_caption_"+pid);
		
		
		for(var i = 0;i < elements.length;i++) {
			elements[i].setAttribute('id','slideshow_container_'+pid+'_'+i);
			elements[i].setAttribute('class','slideshow_container');
			if(el_prev[0]) el_prev[i].setAttribute('id','prev_'+pid+'_'+i);
			if(el_next[0]) el_next[i].setAttribute('id','next_'+pid+'_'+i);
			if(el_count[0]) el_count[i].setAttribute('id','slideshow_count_'+pid+'_'+i);
			if(el_count[0]) el_count[i].setAttribute('class','slideshow_count');
			if(el_nav[0]) el_nav[i].setAttribute('id','slideshow_nav_'+pid+'_'+i);
			$('#slideshow_nav_'+pid+'_'+i).removeClass('slideshow_nav_'+pid);
			if(el_wrapper[0]) el_wrapper[i].setAttribute('id','slideshow_wrapper_'+pid+'_'+i);
			if(el_wrapper[0]) el_wrapper[i].setAttribute('class','slideshow_wrapper');
			if(el_slideclick[0]) el_slideclick[i].setAttribute('id','slideclick_'+pid+'_'+i);
			if(el_slideclick[0]) el_slideclick[i].setAttribute('class','slideclick');
			if(el_caption[0]) el_caption[i].setAttribute('id','slideshow_caption_'+pid+'_'+i);
			if(el_caption[0]) el_caption[i].setAttribute('class','slideshow_caption');
			var divs = elements[i].getElementsByTagName("img");
			if(divs[0]) var slideheight = divs[0].height;
			var slidewidth = 0;
			for(var q=0; q<divs.length;q++) {
				if(divs[q] && divs[q].width > slidewidth) slidewidth = divs[q].width;
				else slidewidth = slidewidth;
				if((isSC || isOz) && divs[q]) {
					if(divs[q].height > slideheight) slideheight = divs[q].height;
					else slideheight = slideheight;
				}
			}
			$('#slideshow_wrapper_'+pid+'_'+i).css("width",slidewidth+"px");
			
			if(slidewidth > 560){
				$('#slideshow_caption_'+pid+'_'+i).css("width","560px");
			} else {
				$('#slideshow_caption_'+pid+'_'+i).css("width",slidewidth+"px");
			}
			
			$('#slideshow_container_'+pid+'_'+i+' br').each(function() { $(this).remove(); });
			
			if($("slideconfig_network").attr("has_thumbs") == "yes") {
				var thumb_position = $("slideconfig_network").attr("thumb_position");
				var nav_position = $("slideconfig_network").attr("nav_position");
				var has_nav = $("slideconfig_network").attr("has_textnav");
				
				if(thumb_position == "top") {
					$('#slideshow_wrapper_'+pid+'_'+i).before('<ul class="slideshow_thumbs" id="slideshow_thumbs_'+pid+'_'+i+'">');
				} else if(thumb_position == "bottom") {
					if(nav_position == "bottom" && has_nav == "yes") {
						$('#slideshow_nav_'+pid+'_'+i).before('<ul class="slideshow_thumbs" id="slideshow_thumbs_'+pid+'_'+i+'">');
						$('#slideshow_nav_'+pid+'_'+i).css("clear","both");
					} else {
						$('#slideshow_wrapper_'+pid+'_'+i).after('<ul class="slideshow_thumbs" id="slideshow_thumbs_'+pid+'_'+i+'">');
					}
				}
				
				$('#slideshow_thumbs_'+pid+'_'+i).css("width",slidewidth+"px");
				
				
				
			} else var has_thumbs = "";
			
			if($("slideconfig_network").attr("is_autoplay") == "yes") var timeout = parseFloat($("slideconfig_network").attr("auto_delay"))*1000;
			else var timeout = 0;
			var transition = $("slideconfig_network").attr("transition");
			if(transition == "none") {
				var transition_speed = 1;
				var transition = "fade";
			} else {
				var transition_speed = '2000';
			}
			
			var first = true;
			var nextSlide;
			
			$(document).ready(function() { 
				$('#slideshow_container_'+pid+'_'+i).cycle({
					fx: transition, 
					pager:  '#slideshow_thumbs_'+pid+'_'+i,
					height: slideheight,
					width: slidewidth,
					next:'#next_'+pid+'_'+i,
					prev:'#prev_'+pid+'_'+i,
					contain:'#slideclick_'+pid+'_'+i,
					timeout:  timeout,
					speed: transition_speed,
					this_i: i,
					
					// callback fn that adjusts the slideshow's height 
					before:	function(){ 
						var $sh = $(this).height();
						var delay = $("slideconfig_network").attr("transition") == "none" ? 10 : 400;
						if($sh > 0 && !isSC && !isOz) $(this).parent().animate({ height: $sh }, delay);
					},
					
					after: function(currSlideElement, nextSlideElement, options, forwardFlag) {
						if(parseInt(nextSlideElement) >= 0) {
							nextSlide = $("#"+$(currSlideElement).parent().attr("id")+" img:nth-child("+parseInt(nextSlideElement)+")");
						} else {
							nextSlide = nextSlideElement;
						}
						
						$(document).trigger("slideshowTransitionFinish", [nextSlide]);
					},
					
					// callback fn that creates a thumbnail to use as pager anchor 
					pagerAnchorBuilder: function(idx, slide) { 
					//return '<li class="slideshow_thumb"><a href="#"><img src="' + getThumbFile(slide.src) + '" /></a></li>'; }
					return '<li class="slideshow_thumb"><a href="#"><img src="' + slide.src + '" /></a></li>'; }
					
				});
			});
			
			if($("slideconfig_network").attr("count_style") == "parenth" && el_count[0]) var count_nav = '(1 of '+divs.length+')';
			else if($("slideconfig_network").attr("count_style") == "no_parenth" && el_count[0]) var count_nav = '1 of '+divs.length;
			$('#slideshow_count_'+pid+'_'+i).html(count_nav);
			
			

		}
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function moveto(which) {
	var threshold = 100;
	var thisid = 0;
	var counter = 0;
	var firstfire = false;
	var padding = document.getElementById('filterinfo') ? 118 : 0;
	if(which == "next") {
		$("#home_content div[rel='homefeed']").each(function() { 
			//console.log("if("+Math.ceil($(this).offset().top-padding)+" > "+$(window).scrollTop()+" && "+$(this).offset().top+" != "+$(window).scrollTop()+")");
			if(counter==0 && $(this).offset().top-padding == $(window).scrollTop() && $(this).hasClass('content_container')) { 
				firstfire = true; 
				$(this).click(); 
			} else {
				if(Math.ceil($(this).offset().top-padding) > Math.ceil($(window).scrollTop()) && Math.ceil($(this).offset().top) != Math.ceil($(window).scrollTop()) && !firstfire) { 
					thisid = this.id;
					$.scrollTo( { top:($('#'+this.id).offset().top-padding), left:0}, 650, { 
								  onAfter:function(){ 
										if(thisid.indexOf("pRow") != -1) $('#'+thisid).click(); 
										window.scrollTo(0,($('#'+thisid).offset().top-padding+1));
								  } 
							}); 
					return false; 
				}
			}
			counter++;
			
		});	
	} else if(which == "prev") {
		$("#home_content div[rel='homefeed']").each(function() { 
			if(Math.ceil($(this).offset().top-padding) < $(window).scrollTop() && $(this).offset().top != $(window).scrollTop()) hit = this;
			else if($(this).offset().top > $(window).scrollTop()) { 
				thisid = hit.id;
				$.scrollTo( { top:($('#'+hit.id).offset().top-padding), left:0}, 650, { onAfter:function(){ if(thisid.indexOf("pRow") != -1) $('#'+thisid).click(); } }); return false; 
				
			}
		});	
	}
	
}

function rollRow(dir,pid,rowtype) {
	var row = document.getElementById("pRow"+pid);
	var arrow = document.getElementById("arrow"+pid);
	if(row.className != "content_container_open" && rowtype == "content") {
		if(dir == "over") {
			if(row) row.className = "content_container over";
			if(arrow) arrow.className = "arrow over";
		} else if(dir == "out") {
			if(row) row.className = "content_container";
			if(arrow) arrow.className = "arrow";
		}
	} else if(rowtype == "people") {
		if(dir == "over") {
			if(row) row.className = "people_container over";
			if(arrow) arrow.className = "arrow over";
			var iframe = document.getElementById("frame_"+pid);
			if(iframe) $("#frame_"+pid+"").contents().find("body").css('background-color','#1A1A1A');
			
		} else if(dir == "out") {
			if(row) row.className = "people_container";
			if(arrow) arrow.className = "arrow";
			var iframe = document.getElementById("frame_"+pid);
			if(iframe) $("#frame_"+pid+"").contents().find("body").css('background-color','#1E1E1E');
		}
	}
}

function openHomePr(pid,url) {
	var container = document.getElementById('pRow'+pid);
	container.setAttribute("onclick","");
	if(container.className != "content_container_open") {
		container.innerHTML = '<div class="loadspin"><img src="_gfx/loadingAnim.gif"></div>';
		$.post("designs/home/detail.php", { pid: pid, viewtype: 'list', url: url, type: "home" },openThisPrInline);
	}
}

function toggleHomeNav() {
	$("#homenav_container").toggle();
	$("#homenav_tab").toggle();
	if(LEFTPAD == 66) LEFTPAD = 305;
	else LEFTPAD = 66;
	shiftPosition();
}

function sendFilter(which) {
	var filtertype = $('input:radio[name=stype]:checked').val();
	var cat = $('#'+which).val();
	cat.replace(" ","-");
	if(filtertype == 'people') document.location.href="/search/people/"+cat;
	else document.location.href="/search/"+cat;
	
	return false;
}

function gohome() {
	document.location.href='/';
	//if (navigator.userAgent.indexOf("Safari") != -1) setTimeout('document.location.reload()',200);
	return false;
}

function whitelist(uid,type) {
	$.post("includes/whitelist-process.php", { uid:uid, type:type }, function(data) { $("#whitelist_"+uid).html(data)});
}

function toggleHomeContent(which) {
	var filtertype = '';
	var cat = '';
	var sortype = '';
	var viewtype = '';
	if(which) {
		if(which.charAt(0) == '/') {
			which = which.substring(1, which.length);
			which=which.split("/");
			viewtype = which[0];
			
			if(viewtype == "filter") {
				if(which.length == 3 && which[1] == 'people') {
					filtertype = 'people';
					cat = which[2];
					sortype = 'recent';
					$('#petype').attr("checked","checked");
				} else if(which.length == 3 && which[1] != 'people') {
					filtertype = 'tags';
					cat = which[2];
					sortype = which[1];
					$('#prtype').attr("checked","checked");
				} else if(which.length == 2) {
					filtertype = 'tags';
					cat = which[1];
					sortype = 'relevant';
					$('#prtype').attr("checked","checked");
				}
				cat = cat.replace("%20"," ");
				cat = cat.replace("-"," ");
				cat = cat.replace("+"," ");
				$('#keywords').val(cat);
				
			} else {
				filtertype = cat = sortype = '';
				$('#keywords').val('');
			}
		}
		
		$(".tabnav").each(function() { $(this).removeClass("selected"); } );
		$("#info_txt_list a").each(function() { $(this).removeClass("selected"); } );
		$("#tab_"+viewtype).addClass("selected");
		$("#home_gallery").html('<div style="margin-left:235px; margin-top:20px;"><img src="_gfx/loadingAnim.gif"></div>');
		if(	viewtype == "featured" || 
			viewtype == "signup" || 
			viewtype == "terms" || 
			viewtype == "opensource" ||
			viewtype == "copyright" || 
			viewtype == "privacy" || 
			viewtype == "showcase" || 
			viewtype == "images") {
			if(viewtype == "images") {
				$("#tab_gallery").addClass("selected");
				$.getScript("/_js/cargo.gallery.js");
				$.post('dispatch.php?r={"c":"following","a":"gallery","g":["gallery","RAND","0","80","true"]}', function(data) {
					$("#home_gallery").html("<div><!-- --></div>"+data);
					GridControl.getLimits();
					GridControl.init();
					$("#gallery_nav").css("visibility", "visible");
				});
			
			} else if(viewtype == "showcase") {
				$("#tab_showcase").addClass("selected");
				$.post('http://dev.cargocollective.com/ozfeed', function(data) {
					$("#home_gallery").html(data);
				});
			
			} else if(viewtype == "featured") {
				var file = "designs/home/cargo-featured";
				
				//$.post(file+".php", { viewtype: viewtype },openHomeInline);
				
				$.post(CARGO.Dispatcher.GetUrl("following/followinglist/gallery"), { url: "gallery" },function(data) { 
					openHomeInline(data); 
					FollowingSniff(); 
				});
			} else if(viewtype == "opensource") {
			 	var file = "designs/home/opensource.php";
			 	$.post(file, {  },function(data) { 
					openHomeInline(data); 
					FollowingSniff(); 
				});
				
			} else {
				if(viewtype == "featuredprojects") var file = "designs/home/cargo-featured";
				else file = "includes/"+viewtype;
				$.post(file+".php", { viewtype: viewtype },openHomeInline);
			}
			
			if(viewtype == "terms" || viewtype == "privacy" || viewtype == "copyright" || viewtype == "opensource" ) {
				$("body").css("background-color","#FFFFFF");
				$("body").css("background-image","url(../_gfx/home_bg_light.gif)");
				$("body").css("background-repeat","repeat-y");
				
			} else {
				$("body").css("background-color","#111111");
				$("body").css("background-image","none");
			}
			$("#nav_tab").css("display","block");
			
		} else if(viewtype == "signup") {
			$.post("start/info.php", { viewtype: viewtype },openHomeInline);
			$("body").css("background-color","#FFFFFF");
			$("body").css("background-image","url(../_gfx/home_bg_light.gif)");
			$("body").css("background-repeat","repeat-y");
			$("#nav_tab").css("display","none");
		} else if(viewtype == "designs") {
			if(viewtype == "designs") var file = "designs/home/browsedesigns";
			$.post(file+".php", { viewtype: viewtype },openHomeInline);
			$("body").css("background-color","#1e1e1e");
			$("body").css("background-image","none");
			$("#nav_tab").css("display","none");
			$("#designs").addClass("selected");
		} else if(viewtype == "preview" || viewtype == "howitworks" || viewtype == "fyi") {
			if(viewtype == "howitworks") {
				var file = "designs/home/howitworks";
				$("#howitworks").addClass("selected");
			} else if(viewtype == "preview") var file = "designs/home/preview";
			else if(viewtype == "fyi") {
				var file = "designs/home/fyi";
				$("#fyi").addClass("selected");
			}
			$.post(file+".php", { viewtype: viewtype },openHomeInline);
			$("body").css("background-color","#000000");
			$("body").css("background-image","url(../_gfx/home_bg_dark.gif)");
			$("body").css("background-repeat","repeat-y");
			$("#nav_tab").css("display","none");
			
		} else if(viewtype == "contact") {
			$.post("/apply/index.php", { viewtype: viewtype },openHomeInline);
			$("body").css("background-color","#000000");
			$("body").css("background-image","url(../_gfx/home_bg_dark.gif)");
			$("body").css("background-repeat","repeat-y");
			$("#contact").addClass("selected");
		} else {
			$.post("designs/home/main.php", { viewtype: viewtype, filtertype:filtertype, cat:cat, sort:sortype },openHomeInline);
			//$("#home_gallery").html('<div style="margin-left: 300px; margin-top: 20px;">Temporarily disabled</div>');
			$("body").css("background-color","#000000");
			$("body").css("background-image","url(../_gfx/home_bg_dark.gif)");
			$("body").css("background-repeat","repeat-y");
			$("#nav_tab").css("display","none");
		} 
		
	}
	
	$("#search_form .search").focus(function() {
        if($(this).val() == $(this).attr("rel")) $(this).val("");
    }).blur(function() {
        if($(this).val() == "") $(this).val($(this).attr("rel"));
    }).blur();
	
}

function openHomeInline(data) {
	$("#home_gallery").html(data);
}

function closeHomePr(pid,url) {
	var viewtype = $("#viewtype").val();
	var container = document.getElementById('pRow'+pid);
    // // Fire an event: projectClose
    $(document).trigger("projectClose", [container]);    
	container.className = "content_container";
	if(container.className != "content_container_open") {
		container.innerHTML = '<div class="loadspin"><img src="_gfx/loadingAnim.gif"></div>';
		$.post("/designs/home/process.php", { processtype: "close", viewtype: viewtype, url: url, pid: pid  },closeThisPrInline);
	}
}

function closeThisPrInline(data) {
	var starting = data.indexOf("|#=#|");
	var starting2 = data.indexOf("|##=##|");
	var pid = data.substring(0, starting);
	var url = data.substring((starting+5), starting2);
	var content = data.substring((starting2+7), data.length);
	var container = document.getElementById('pRow'+pid);	
	$('#pRow'+pid).after(content).remove(); 
}


var isIE = testIE();
var checkInterval = 200;
var preloadDistance = 1500;
var isUpdating = false;
var mouseState = "up";
var id;

function testIE() {
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) return true;
	else return false;
}


function getMoreHomeHistory() {
	var indexVal = parseInt($("#current_page").val());
	var viewtype = $("#viewtype").val();
	var filtertype = $("#filtertype").val();
	var cat = $("#cat").val();
	var url = $("#url").val();
	var sorttype= $("#sort").val();
	
	if (indexVal <= parseInt($("#total_pages").val()) && $("#home_content").length > 0) {
		$.post("/designs/home/process.php", { startRow: indexVal, processtype: "pagination", viewtype: viewtype, filtertype: filtertype, cat: cat, sorttype: sorttype  },addMoreHomeHistory);
		$("#moreload").show();
		isUpdating = true;
	}
	return false;
}

function failure() {
	$("#new_page_content").innerHTML = "<p><strong>Could not contact the server.</strong><br />Please wait awhile and try again. <br /><br />We apologize for the inconvenience.</p>";
}

function addMoreHomeHistory(data) {
	response = data.substring(0, data.length)
	if (response == "No results") {
		$("#moreload").hide();
	} else {
		$("#new_page_content").before(response);
		$("#moreload").hide();
		$("#current_page").val(parseInt($("#current_page").val()) + parseInt($("#page_limit").val()));
	}
	isUpdating = false;
}

function updateHomePage(){
	if ((isIE && isUpdating == false && getPageHeight() - getScrollHeight() < preloadDistance) || (!isIE && mouseState == "up" && isUpdating == false && getPageHeight() - getScrollHeight() < preloadDistance)) {
		getMoreHomeHistory();
	}
	if (parseInt($("#current_page").val()) < parseInt($("#total_pages").val()) && parseInt($("#total_pages").val()) != 1) {
		setTimeout("updateHomePage()", checkInterval);
	}
	
}

function onMouseDown(){
	mouseState = "down";
}

function onMouseUp(){
	mouseState = "up";
}


function init_home( ){
	document.onmousedown = onMouseDown;
	document.onmouseup = onMouseUp;
	
	id = $("page_id").value;

	var fromBackButton = false;
	var winloc = window.location+"";
	if(winloc.indexOf("errorDocument") < 0) setTimeout("updateHomePage()", checkInterval);

}

function submitApplication() {
	if(isValidEmail()) {
		$.post("/apply/index.php", { application_email:$("#application_email").val(), application_message:$("#application_message").val() },
			function(data) { 
				$("#application_form").html(data);
			}
		);
		$("#application_form").html('<img src="/_gfx/loadingAnim.gif" />');
	}
}

function isValidEmail() {
	var str = document.getElementById("application_email").value;
	if(str.indexOf(".") >= 1 && str.indexOf("@") > 0) {
		return true;
	} else {
		alert("You must enter a valid email address");
		return false;
	}
}


function checkHomePaginate() {
	if ((isIE && isUpdating == false && getPageHeight() - getScrollHeight() < preloadDistance) || (!isIE && mouseState == "up" && isUpdating == false && getPageHeight() - getScrollHeight() < preloadDistance)) {
		getMoreHomeHistory();
	}
}



function getPageHeight(){
  var y;
  var test1 = document.body.scrollHeight;
  var test2 = document.body.offsetHeight
  if (test1 > test2) {
    y = document.body.scrollHeight;
  } else {
	  y = document.body.offsetHeight;
  }
  return parseInt(y);
}

function _getWindowHeight(){
  if (self.innerWidth) {
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientWidth) {
    frameWidth = document.documentElement.clientWidth;
    frameHeight = document.documentElement.clientHeight; 
  } else if (document.body) {
    frameWidth = document.body.clientWidth;
    frameHeight = document.body.clientHeight;
  }
  return parseInt(frameHeight);
}

function getScrollHeight(){
  var y;
  if (self.pageYOffset) {
      y = self.pageYOffset;
  } else if (document.documentElement && document.documentElement.scrollTop) {
      y = document.documentElement.scrollTop;
  } else if (document.body)	{
      y = document.body.scrollTop;
  }
  return parseInt(y)+_getWindowHeight();
}



	homeclose=new Image();
 	homeclose.src="/_gfx/home-close.gif";
	homeclose_o=new Image();
 	homeclose_o.src="/_gfx/home-close-o.gif";
	
	home_next=new Image();
 	home_next.src="/_gfx/btn_home_next.gif";
	home_next_o=new Image();
 	home_next_o.src="/_gfx/btn_home_next_o.gif";
	
	home_prev=new Image();
 	home_prev.src="/_gfx/btn_home_prev.gif";
	home_prev_o=new Image();
 	home_prev_o.src="/_gfx/btn_home_prev_o.gif";

