/* CONTINUT */
/* text inserat in div class ".javainsertcontent" -hoverimg.css */
/* Open external links in new window - sters? */
/* smart columns -hoverimg.css */
/* Entire block clickable, pane-list -main_content.css */
/* add-icons-to-your-links-automatically -hoverimg.css */
/* folder collapser -hoverimg.css */
/* Smooth Scroll Back to Top -inline head */
/* Rollovers for issues and topics -main_diverse.css */
/* tabel cu rinduri colorate diferit, table -main_diverse.css */
/* slide hover #vertical -main_diverse.css */
/* slideviewer -slideviewer.js -main_diverse2.css */
/* slide -slidebox.js, slidebox.css */
/* accordion -main_diverse2.css */
/* easy slider, easySlider1.5.js -main_diverse2.css */
/* ongray gallery -main_diverse2.css */


/* http://api.jquery.com/append/ */
/* text inserat in div class ".javainsertcontent" */
$(document).ready(function() {
$(".javainsertcontent").append("International Aerial Archaeology Conference"); // keeps content intact, and adds the new content to the end
});

/* smart columns */
$(document).ready(function(){
	$('a[href^="http://"]')	.attr({ target: "_blank" });
	function smartColumns() {
		$("ul.column").css({ 'width' : "100%"});
		var colWrap = $("ul.column").width();
		var colNum = Math.floor(colWrap / 200);
		var colFixed = Math.floor(colWrap / colNum);
		$("ul.column").css({ 'width' : colWrap});
		$("ul.column li").css({ 'width' : colFixed});
	}	
	smartColumns();	
	$(window).resize(function () {
		smartColumns();
	}); 
});
/* END smart columns */

/* Entire block clickable */ 
$(document).ready(function(){
	$(".pane-list li").click(function(){
    	window.location=$(this).find("a").attr("href");return false;
	});
}); //close doc ready
/* END Entire block clickable */

/* add-icons-to-your-links-automatically */
$(document).ready(function() {
	$("a[href$='.pdf']").addClass("pdf");
	$("a[href$='.doc'], a[href$='.txt'], a[href$='.nfo'], a[href$='.rtf']").addClass("txt");
	$("a[href$='.xls']").addClass("xls");
	$("a[href$='.pps'], a[href$='.ppt']").addClass("pps");
	$("a[href$='.zip'], a[href$='.rar']").addClass("zip");
	$("a[href$='.jpg'], a[href$='.jpeg'], a[href$='.psd'], a[href$='.gif']").addClass("jpg");
	$("a[href^='mailto:']").addClass("email");
	/*$('a').filter(function() {
	    return this.hostname && this.hostname !== location.hostname;
	  }).addClass("external");*/
});
/* END add-icons-to-your-links-automatically */


/* folder collapser */
$(document).ready(function() {
	folderCollapser();
});

function folderCollapser() {
	
	var myContentCollection = document.getElementsByTagName("div");
	
	for (var i = 0; i < myContentCollection.length; i++) {
		if (myContentCollection[i].className == "folder_content") {
			myContentCollection[i].style.display = "none";
		}
	}
	
	var myUnitClass = "folder_link";
	var myUnitLinkCollapsed = "folder_link_collapsed";
	var myUnitLinkExpanded = "folder_link_expanded";
	var myUnitContent = "folder_content";
	var myAnimationSpeed = "slow";

	myLinkCollection = document.getElementsByTagName("a");
	
	for (var i = 0; i < myLinkCollection.length; i++)
	{
		if (myLinkCollection[i].className == myUnitClass)
			{
				myLinkCollection[i].className = myUnitClass + " " + myUnitLinkCollapsed;
				myLinkCollection[i].onclick = function()
					{
					var myCurrentId = this.id;
					var myCurrentNumber = myCurrentId.replace(myUnitClass + "_", "");
					
					if (this.className == myUnitClass + " " + myUnitLinkCollapsed)
						{
						$("#" + myUnitContent + "_" + myCurrentNumber).slideDown(myAnimationSpeed);
						this.className = myUnitClass + " " + myUnitLinkExpanded;
						}
						else
						{
						$("#" + myUnitContent + "_" + myCurrentNumber).slideUp(myAnimationSpeed);
						this.className = myUnitClass + " " + myUnitLinkCollapsed;
						}
					return false;

					}

			}

	}
}
/* END folder collapser */


// Smooth Scroll Back to Top
var scrollToTop = function(){ $('a[href=#top]').click(function(){ backToTop(); return false;} ) };
function backToTop() {
    var x1 = x2 = x3 = 0;
    var y1 = y2 = y3 = 0;
    if (document.documentElement) {
        x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }
    if (document.body) {
        x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }
    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;
    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));
    window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
    if (x > 0 || y > 0) {
        window.setTimeout("backToTop()", 60);
    }
}
$(document).ready(scrollToTop);
// end Smooth Scroll Back to Top

// Rollovers for issues and topics
$(document).ready(function() {
	$('.square200').hover(function(){
		$(this).addClass('square299');
	},function(){
		$(this).removeClass('square299');
	});
});

$(document).ready(function() {
	$('.square600, .square601').hover(function(){
		$(this).addClass('square699');
	},function(){
		$(this).removeClass('square699');
	});
});

/* blue square 10x */
$(document).ready(function() {
  $('.square100').hover(function() {
    $(this).addClass('square101');
  }, function() {
    $(this).removeClass('square101');
  });
});

$(document).ready(function() {
  $('.square300').hover(function() {
    $(this).addClass('square301');
  }, function() {
    $(this).removeClass('square301');
  });
});


/* http://www.cssnewbie.com/new-example-page-formatting */
/* tabel cu rinduri colorate diferit */
$(document).ready(function(){
	$("table.difrows tr:even").addClass("table.difrows even");
	$("table.difrows tr:odd").addClass("table.difrows odd");
});
/*
$(document).ready(function(){
	$(".menuS4 li:even").addClass("evenli");
	$(".menuS4 li:odd").addClass("oddli");
});

$(document).ready(function(){
	$(".colOne_3col3 p:even").addClass("evenli");
	$(".colOne_3col3 p:odd").addClass("oddli");
});*/
/* end http://www.cssnewbie.com */

/* slide hover */
$(function(){
	// Vertical
	$("#vertical div a").hover(function(){
		$("img", this).stop().animate({top:"-130px"},{queue:false,duration:200});
	}, function() {
		$("img", this).stop().animate({top:"0px"},{queue:false,duration:200});
	});
	// Horizontal
	$("#horizontal div a").hover(function(){
		$("img", this).stop().animate({left:"-296px"},{queue:false,duration:200});
	}, function() {
		$("img", this).stop().animate({left:"0px"},{queue:false,duration:200});
	});
});
/* end slide hover */

/* slideviewer */
$(window).bind("load", function() {
	$("div#mygaltop").slideView({toolTip: false, ttOpacity: 0.5});	
	$("div#mygaltop2").slideView({toolTip: false, ttOpacity: 0.5});
	$("div#mygaltop3").slideView({toolTip: false, ttOpacity: 0.5});
	$("div#mygalone").slideView(); //if leaved blank performs the default kind of animation (easeInOutExpo, 750)
	$("div#mygaltwo").slideView({
		easeFunc: "easeInOutBounce",
		easeTime: 2200
	}); 
	$("div#mygalthree").slideView({
		easeFunc: "easeInOutSine",
		easeTime: 500,
		toolTip: true
	});

});
/* END slideviewer */

/* slide */
/*$(document).ready(function(){*/
$(function(){
		$("#slide-up").slideBox({width: "100%", height: "355px", position: "top"});
	});
/* END slide */

/* accordion */
$(document).ready(function() {
	$('.accordionButton').click(function() {
		$('.accordionButton').removeClass('accordionon');
	 	$('.accordionContent').hide();
		if($(this).next().is(':hidden') == true) {
			$(this).addClass('accordionon');
			$(this).next().show();
			// replace .slideDown('normal') with .show() and .slideUp('normal') with .hide()
		 } 
	 });
	$('.accordionButton').mouseover(function() {
		$(this).addClass('accordionover');
	}).mouseout(function() {
		$(this).removeClass('accordionover');										
	});
	$('.accordionContent').hide();
	$('.openaccordion').trigger('click');
});
/* END accordion */

/* easy slider, easySlider1.5.js */
		$(document).ready(function(){	
			$("#easyslider1").easySlider({
				controlsBefore:	'<p id="controls1">',
				controlsAfter:	'</p>',
				auto: true, 
				continuous: true
			});
			$("#easyslider2").easySlider({
				controlsBefore:	'<p id="controls2">',
				controlsAfter:	'</p>',		
				prevId: 'prevBtn2',
				nextId: 'nextBtn2'	
			});	
		});	
/* END easy slider, easySlider1.5.js */

/* ongray gallery */
$(document).ready(function() {
	
	$("ul.gallerygray li").hover(function() { //On hover...
		
		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		
		//Set a background image(thumbOver) on the &lt;a&gt; tag 
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Fade the image to 0 
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		}); 
	} , function() { //on hover out...
		//Fade the image to 1 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
 
});
/* END ongray gallery */


