// JS Pseudo-Framework
// We will reference to DOM elements via #ID attribute, not form names
// eg. document.getElementById('elemID') or document.forms[0]




var defaultHost 	= '';

function $(id) {
	return document.getElementById(id);
}



// Password checking: 2 password fields mut be equal, min 6 chars length
function passIsEqual( pass1ID, pass2ID ) {
	var pass1 =  document.getElementById( pass1ID );
	var pass2 =  document.getElementById( pass2ID );
	if( pass1.value == pass2.value ) {
		return true;
	}
	return false;
}

// Input is not empty
function isNotEmptyField( idElem ) {
	if( document.getElementById( idElem ) ) {
		if( document.getElementById( idElem ).value != "" ) {
			return true;
		}
		document.getElementById( idElem ).focus();
	}
	return false;
}

// Value is higher than (integer)
function higherThan( idElem, indexInt ) {
	if( document.getElementById( idElem ) ) {
		if( document.getElementById( idElem ).value.length > indexInt ) {
			return true;
		}
		document.getElementById( idElem ).focus();
	}
	return false;
}

// Value is equal (integer)
function equalAs( idElem, indexInt ) {
	if( document.getElementById( idElem ) ) {
		if( document.getElementById( idElem ).value.length == indexInt ) {
			return true;
		}
		document.getElementById( idElem ).focus();
	}
	return false;
}

// Radio or checkbox is selected
function isChecked( idElem ) {
	if( document.getElementById( idElem ) ) {
		if( document.getElementById( idElem ).checked ) {
			return true;
		}
	}
	return false;
}


// Valid e-mail
function isValidEmail( elem ) {
	str = document.getElementById(elem).value;
	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

// Set focus on input
function setFocus( idElem ) {
	document.getElementById( idElem ).focus();
}

// Clear inputvalue
function clearValue( idElem ) {
	document.getElementById( idElem ).value = '';;
}



function getObj(name){
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	} else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

/*
var onLoadImageIndex = 0;
var onLoadImageLoader = new Array();
function addImageOnLoad( targetId, imageUrl ) {
	onLoadImageLoader[onLoadImageIndex] = new Array();
	onLoadImageLoader[onLoadImageIndex][0] = new Image();
	onLoadImageLoader[onLoadImageIndex][0].src = imageUrl;
	onLoadImageLoader[onLoadImageIndex][1] = targetId;
	onLoadImageLoader[onLoadImageIndex][2] = imageUrl;
	onLoadImageIndex++;
}


// Load image as background
function loadImageAsBackground( changeId, imageLink1, imageLink2 ) {
	addImageOnLoad( changeId, imageLink1 );
	addImageOnLoad( changeId, imageLink2 );
}


var actuallyLoaded = new Array();
function performAllCalculations() {
	for(var i=0; i<onLoadImageLoader.length; i++ ) {
		if( onLoadImageLoader[i][0].width  > 0 ) {
			if( document.getElementById(onLoadImageLoader[i][1]) ) {
				document.getElementById(onLoadImageLoader[i][1]).style.background='url('+onLoadImageLoader[i][2]+') no-repeat 50% 50%;';
			}
		}
	}
}
*/

//onload = performOnLoad;
var loadFormPage = false;
var loadFriendsPage = false;
var loadGalleryPage = false;
var loadFriendsPageSmall = false;
var loadFriendsPage4 = false;
var loadKeywordUserPage = false;
var loadAccessUserShow = false;
var loadSchulePage = false;
var loadSchulePageNew = false;
var loadKeywordYotube = false;
var loadForumBox = false;
var loadOpenConnection = false;
var gmap = false;
var myEffect;
function performOnLoad() {
	//performAllCalculations();
	if( loadFormPage != false ) {
		loadFormPages();
	}
	if( loadFriendsPage != false ) {
		loadFriendsPages();
	}
	if( loadGalleryPage != false ) {
		loadGalleryPages();
	}
	if( loadFriendsPageSmall != false ) {
		loadFriendsPagesSmall();
	}
	if( loadFriendsPage4 != false ) {
		loadFriendsPages4();
	}	
	if( loadKeywordUserPage != false ) {
		loadKeywordUserPages();
	}	
	if( loadAccessUserShow != false ) {
		loadAccessUserShows();
	}	
	if( loadSchulePage != false ) {
		loadSchulePages();
	}
	if( loadSchulePageNew != false ) {
		loadSchulePagesNew();
	}
	if( loadKeywordYotube != false ) {
		loadKeywordYotubes();
	}
	if( loadForumBox != false ) {
		loadForumsBox();
	}
	if( loadOpenConnection != false ) {
		loadOpenConnections();
	}
	if( gmap != false ) {
		gmap_show();
	}
	
	if( typeof( mooMeFx ) != "undefined" ) {
		var myelement = document.getElementById('dontshowthis');
		myEffect = new fx.Height(myelement , {duration: 500 });
		setTimeout( "myEffect.toggle()", 1000 );
	}
}


function calculateUserPath( userID ) {
	var tempVar = Math.round( userID / 10000 );
	return tempVar+"/"+userID+"/avatar";
}
