function submitLogin(){
	document.getElementById('formLogin').submit()
}

function assignElements(){
	// assigning colorbox even to elements
	$(document).ready(function(){
		$("a[rel='children']").colorbox();
		$("a[rel='family']").colorbox();
		$("a[rel='senior']").colorbox();
		$("a[rel='maternity']").colorbox();
	});
}
function mouseOver(data){
	data.style.opacity=1;
	data.filters.alpha.opacity=100
	data.style.cursor='pointer'
}

function mouseOut(data){
	data.style.opacity=0.5
	data.filters.alpha.opacity=50
	data.style.cursor='pointer'
}

function buttonMouseDefault(data){document.getElementById(data.id).className = data.id + 'Default'}
function buttonMouseOver(data){document.getElementById(data.id).className = data.id + 'Over'}
function buttonMouseDown(data){document.getElementById(data.id).className = data.id + 'Down'}

function loadLinks(){
	
	var links = ''
	window.parent.document.getElementById('galleryLinks').innerHTML = ''
	
	var galleries = new Array
	
	// ADD NEW GALLERIES HERE
	galleries[1] = 'children'
	galleries[2] = 'family'
	galleries[3] = 'senior'
	galleries[4] = 'maternity'
	
	// running through each gallery and creating links
	for(var h=1; h<=10; h++){
		if(document.getElementById(galleries[h] + '-1')){ // checking if the gallery has been added and if not skipping
			for(var i=1; i<=100; i++){
				var newLink = '<a href="gallery/' + galleries[h] + '/slides/' + i + '.jpg" rel="' + galleries[h] + '" id="link' + galleries[h] + '-' + i + '">' + i + '</a>'
				if(i==100){}else{links = links + newLink}
				
				var added = i+1
				if(document.getElementById(galleries[h] + '-' + added)){}else{i=100} // stopping the loop if there is no longer any images to load
			}
		}
	}
	window.parent.document.getElementById('galleryLinks').innerHTML = links
	window.parent.assignElements()
}

// Gallery scrolling button controls

function buttonRight(data){
	if(document.getElementById(data.id).className == 'arrowRightDeactivated'){
	}
	else{
		document.getElementById(data.id).className = 'arrowRightActivated'
	}
}
function buttonLeft(data){
	if(document.getElementById(data.id).className == 'arrowLeftDeactivated'){
	}
	else{
		document.getElementById(data.id).className = 'arrowLeftActivated'
	}
}
function buttonRightDown(data){
	if(document.getElementById(data.id).className == 'arrowRightDeactivated'){
	}
	else{
		document.getElementById(data.id).className = 'arrowRightActivatedDown'
	}
}
function buttonLeftDown(data){
	if(document.getElementById(data.id).className == 'arrowLeftDeactivated'){
	}
	else{
		document.getElementById(data.id).className = 'arrowLeftActivatedDown'
	}
}
function buttonLeftDeactivated(){
	document.getElementById(data.id).className = 'arrowLeftDeactivated'
}
function buttonRightDeactivated(){
	document.getElementById(data.id).className = 'arrowRightDeactivated'
}

// contact page functions

function contactSubmit(){
	document.getElementById('contactform').submit()
}
