function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_advOpenBrWindow(theURL,winName,features,orgName) {
  var remote = open(theURL, winName, features);
  if (remote.opener == null) // if something went wrong
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}
//clearing input fields start
function ClearInput(value, id){
var input = MM_findObj(id);
	if(value == input.value){
		input.value = '';
	}
	else{
		input.value = input.value;
	}
}
//clearing input fields end
function MM_openBrWindow2(theURL2) {
  window.location.href = theURL2;
}
//fakeHover start
function setFakeHover(ID) {
	//MM_findObj(ID).style.backgroundPosition = "0 -11px";
	obj = MM_findObj(ID);
	if (!obj) return;

    if(obj.length > 1)
    {
        for(var i = 0; i < obj.length; i++)
        {
            obj[i].style.backgroundPosition = '0 -11px';
        }
    }
    else
    {
        obj.style.backgroundPosition = '0 -11px';
    }
}
function unSetFakeHover(ID) {
	//MM_findObj(ID).style.backgroundPosition = "0 0";
	obj = MM_findObj(ID);
	if (!obj) return;

    if(obj.length > 1)
    {
        for(var i = 0; i < obj.length; i++)
        {
            obj[i].style.backgroundPosition = '0 0';
        }
    }
    else
    {
        obj.style.backgroundPosition = '0 0';
    }
}
/*function setFakeHover2(ID) {
	MM_findObj(ID).style.background = "#FFFFFF";
}
function unSetFakeHover2(ID) {
	MM_findObj(ID).style.background = "url(images/UI/bg-transWhite-695.png) repeat-y";
}*/
//fakeHover end
//popUp div start
var amID = "blank";
function showMe(containerId){
	if(amID != "blank"){
		hideMe(amID);	
	}
	amID = containerId;
	showContainer(containerId);
}
function showContainer(containerId){
	obj = MM_findObj(containerId);
	if (!obj) return;
	obj.style.display = 'block';
}
function hideMe(containerId){
	obj2 = MM_findObj(containerId);
	if (!obj2) return;
	obj2.style.display = 'none';
}
//popUp div end
//popUp div start
var amID2 = "blank";
function showMe2(containerId2){
	if(amID2 != "blank"){
		hideMe2(amID2);	
	}
	amID2 = containerId2;
	showContainer2(containerId2);
}
function showContainer2(containerId2){
	obj = MM_findObj(containerId2);
	if (!obj) return;
	obj.style.display = 'block';
}
function hideMe2(containerId2){
	obj2 = MM_findObj(containerId2);
	if (!obj2) return;
	obj2.style.display = 'none';
}
//popUp div end
//change that class then back start
var amClassId = "blank";
var amClassId2 = "blank";
function changeClass(Id){
	if(amClassId != "blank"){
		changeBack(amClassId);
	}
	amClassId = Id;
	setClass(Id);
}
function changeClass2(Id){
	if(amClassId2 != "blank"){
		changeBack(amClassId2);
	}
	amClassId2 = Id;
	setClass(Id);
}
function setClass(Id){
	obj = MM_findObj(Id);
	if (!obj) return;
	if(obj.className.length > 0){
		obj.className += " active";
	}
	else {
		obj.className = " active";
	}
}
function changeBack(Id){
	obj2 = MM_findObj(Id);
	if (!obj2) return;
	obj2.className = obj2.className.replace(/ active/, "");
}
//change that class then back end
//change that class then back start
var amClassId3 = "blank";
function changeClass3(Id){
	if(amClassId3 != "blank"){
		changeBack3(amClassId3);
	}
	amClassId3 = Id;
	setClass3(Id);
}
function setClass3(Id){
	obj = MM_findObj(Id);
	if (!obj) return;
	obj.className += "active";
	obj.innerHTML = "Selected Time/date";
}
function changeBack3(Id){
	obj2 = MM_findObj(Id);
	if (!obj2) return;
	obj2.className = '';
	obj2.innerHTML = "Select this Time/date";
}
//change that class then back end
//build those inputs man i got heaps of mates!! start
var increaseIdCount = 3;
function buildMeInputs(){
	obj = MM_findObj('moreInputs');
	increaseIdCount++;
	try {
		var newInput = document.createElement('<input class="friends" type="text" id="friendName'+increaseIdCount+'" name="friendName'+increaseIdCount+'" value="enter your friends name" onfocus="ClearInput(\'enter your friends name\', this.id);" />');
		var newInput2 = document.createElement('<input class="friends friendsAlt" type="text" id="friendEmail'+increaseIdCount+'" name="friendEmail'+increaseIdCount+'" value="enter your friends email address" onfocus="ClearInput(\'enter your friends email address\', this.id);" />');
	} catch (e) {
		var newInput = document.createElement("input");
		newInput.setAttribute("class", "friends");
		newInput.setAttribute("type", "text");
		newInput.setAttribute("id", "friendName"+increaseIdCount);
		newInput.setAttribute("name", "friendName"+increaseIdCount);
		newInput.setAttribute("value", "enter your friends name");
		newInput.setAttribute("onfocus", "ClearInput('enter your friends name', this.id);");
		
		var newInput2 = document.createElement("input");
		newInput2.setAttribute("class", "friends friendsAlt");
		newInput2.setAttribute("type", "text");
		newInput2.setAttribute("id", "friendEmail"+increaseIdCount);
		newInput2.setAttribute("name", "friendEmail"+increaseIdCount);
		newInput2.setAttribute("value", "enter your friends name");
		newInput2.setAttribute("onfocus", "ClearInput('enter your friends name', this.id);");
	}
	obj.appendChild(newInput);
	obj.appendChild(newInput2);
}
var posy = 0;
function showSched(e) {

	if (!e) var e = window.event;
	if (e.pageX || e.pageY) {
	   posy = e.pageY  + 60;
	}
	else if (e.clientX || e.clientY) {
	   posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop + 60;
	}

}
function showTimedContainer(containerId){
	obj = MM_findObj(containerId);
	if (!obj) return;
	obj.style.display = 'block';
	setTimeout("hideMe('viewError')", 5000);
	setTimeout("hideMe('shareITError')", 5000);
}
