function hideAll(obj,a) {
for (i=0;i<obj;i++)
{
var el = document.getElementById(i);
el.style.display='none';
}

for (i=0;i<a;i++)
{
document.getElementById("multi"+i).style.display='none';
}

}

function toggleNav() {

if (document.getElementById('main').style.marginLeft=='13px')
{
document.getElementById('maincontainer').style.backgroundImage='url("leftnav.gif")';
document.getElementById('main').style.marginLeft='165px';
document.getElementById('sidediv').style.display='';
} else {
document.getElementById('maincontainer').style.backgroundImage='none';
document.getElementById('main').style.marginLeft='13px';
document.getElementById('sidediv').style.display='none';
}
}


function editFunc(arg) {
if (document.getElementById(arg).style.background='#164677') {
document.getElementById('nav1').style.background='#164677';
document.getElementById('nav1').style.borderBottom='1px solid #164677';
document.getElementById('nav1').style.fontSize='100%';
document.getElementById('nav1').style.fontWeight='normal';

document.getElementById('nav2').style.background='#164677';
document.getElementById('nav2').style.borderBottom='1px solid #164677';
document.getElementById('nav2').style.fontSize='100%';
document.getElementById('nav2').style.fontWeight='normal';

document.getElementById('nav3').style.background='#164677';
document.getElementById('nav3').style.borderBottom='1px solid #164677';
document.getElementById('nav3').style.fontSize='100%';
document.getElementById('nav3').style.fontWeight='normal';

document.getElementById('nav4').style.background='#164677';
document.getElementById('nav4').style.borderBottom='1px solid #164677';
document.getElementById('nav4').style.fontSize='100%';
document.getElementById('nav4').style.fontWeight='normal';

document.getElementById('nav5').style.background='#164677';
document.getElementById('nav5').style.borderBottom='1px solid #164677';
document.getElementById('nav5').style.fontSize='100%';
document.getElementById('nav5').style.fontWeight='normal';

document.getElementById('nav6').style.background='#164677';
document.getElementById('nav6').style.borderBottom='1px solid #164677';
document.getElementById('nav6').style.fontSize='100%';
document.getElementById('nav6').style.fontWeight='normal';

document.getElementById(arg).style.background='#afc3d9';
document.getElementById(arg).style.borderBottom='1px solid #afc3d9';
document.getElementById(arg).style.fontSize='110%';
document.getElementById(arg).style.fontWeight='bold';
}
}

function bottomFunc(arg) {
if (document.getElementById(arg).style.display='none') {

document.getElementById('address').style.display='none';
document.getElementById('lease').style.display='none';
document.getElementById('pics').style.display='none';
document.getElementById('descdiv').style.display='none';
document.getElementById('details').style.display='none';
document.getElementById('contact').style.display='none';

document.getElementById(arg).style.display='block';
}
}

function bottomSubmit(arg) {
if (document.getElementById(arg).style.display='none') {
document.getElementById('addressbottom').style.display='none';
document.getElementById('leasebottom').style.display='none';
document.getElementById('picsbottom').style.display='none';
document.getElementById('descbottom').style.display='none';
document.getElementById('detailsbottom').style.display='none';
document.getElementById('contactbottom').style.display='none';

document.getElementById(arg).style.display='block';
}
}

function checkBottom(arg) {
document.editform.addressbox.checked=false;
document.editform.leasebox.checked=false;
document.editform.picsbox.checked=false;
document.editform.descbox.checked=false;
document.editform.detailsbox.checked=false;
document.editform.contactbox.checked=false;

document.getElementById(arg).checked=true;
}

function mainRadio(arg) {
document.getElementById(arg).checked=true;
}

function confirmDelete() {
if (confirm ("Are you sure you want to delete this image?")) {
document.editform.submit();
} else {
document.editform.delpic.selectedIndex = 0;
}
}

function confirmDelProp(arg) {
if (confirm ("Are you sure you want to delete this property? (This cannot be undone.)")) {
window.location.href=arg;
}
}

function confirmDelAcct(arg) {
if (confirm ("Are you sure you want to delete your account? All properties and pictures associated with this account will be permanently deleted.  This cannot be undone")) {
window.location.href=arg;
}
}

function setActivate(arg) {
document.getElementById(arg).checked=true;
document.editform.submit();
}

function setInActivate(arg) {
document.getElementById(arg).checked=true;
document.editform.submit();
}

function noenter() {
  return !(window.event && window.event.keyCode == 13); }
  
function scrollToBottom(arg) {
var mydiv = document.getElementById(arg);
mydiv.scrollTop = (mydiv.scrollHeight - mydiv.clientHeight)*.7;
}

function processRoll(arg,b,d,e) {
//b=($down) d=($bottom)."
var z=document.getElementById('scrollmap').scrollTop;
var w=document.getElementById('scrollmap').clientHeight;
var c=b+7;
var x=w-z;//+(868-400-z)
var y=c+130;
var v=868-(d-130);
//alert("Distance from bottom of scrollbar "+d+". dot position is "+c+". scrollTop is "+z+". ClientHeight is "+w);
//alert("Flip up since scrollbars : "+(z+w)+"<"+v);
if (z>(b-130)) {
document.getElementById(arg).style.bottom='';
document.getElementById(arg).style.top=c+'px';
document.getElementById(arg).style.display='block';
//alert("Flip down since scrollbars : "+(z)+">"+(b-130));
} else if ((b+130)>(z+w)) {
//alert("Flip up since scrollbars : "+(b+130)+">"+(z+w));
document.getElementById(arg).style.top='';
document.getElementById(arg).style.bottom=(d-15)+'px';
document.getElementById(arg).style.display='block';
} else if (e=="top") {
//alert(e);
document.getElementById(arg).style.top='';
document.getElementById(arg).style.bottom=(d-15)+'px';
document.getElementById(arg).style.display='block';
} else {
document.getElementById(arg).style.bottom='';
document.getElementById(arg).style.top=c+15+'px';
document.getElementById(arg).style.display='block';
}
//alert("bottom: "+document.getElementById(arg).style.bottom+" and top is "+document.getElementById(arg).style.top);
}

function checkAll(arg) {
for (i=0;i<arg;i++) {
var j = "document.compform.id"+(i+1);
eval(j+".checked=true");
}
}

function unCheckAll(arg) {
for (i=0;i<arg;i++) {
var j = "document.compform.id"+(i+1);
eval(j+".checked=false");
}
}


function mainRadio(arg) {
document.getElementById(arg).checked=true;
}

function confirmDelete() {
if (confirm ("Are you sure you want to delete this image?")) {
document.editform.submit();
} else {
document.editform.delpic.selectedIndex = 0;
}
}

function confirmDelProp(arg) {
if (confirm ("Are you sure you want to delete this property? (This cannot be undone.)")) {
window.location.href=arg;
}
}

function confirmDelAcct(arg) {
if (confirm ("Are you sure you want to delete your account? All properties and pictures associated with this account will be permanently deleted.  This cannot be undone")) {
window.location.href=arg;
}
}

function setActivate(arg) {
document.getElementById(arg).checked=true;
document.editform.submit();
}

function setInActivate(arg) {
document.getElementById(arg).checked=true;
document.editform.submit();
}

function noenter() {
  return !(window.event && window.event.keyCode == 13); }
  
function scrollToBottom(arg) {
var mydiv = document.getElementById(arg);
mydiv.scrollTop = (mydiv.scrollHeight - mydiv.offsetHeight)*.7;
//clientHeight
}

function processRoll(arg,b,d,e) {
//b=($down) d=($bottom)."
var z=document.getElementById('scrollmap').scrollTop;
var w=document.getElementById('scrollmap').clientHeight;
var c=b+7;
var x=w-z;//+(868-400-z)
var y=c+130;
var v=868-(d-130);
//alert("Distance from bottom of scrollbar "+d+". dot position is "+c+". scrollTop is "+z+". ClientHeight is "+w);
//alert("Flip up since scrollbars : "+(z+w)+"<"+v);
if (z>(b-130)) {
document.getElementById(arg).style.bottom='';
document.getElementById(arg).style.top=c+'px';
document.getElementById(arg).style.display='block';
//alert("Flip down since scrollbars : "+(z)+">"+(b-130));
} else if ((b+130)>(z+w)) {
//alert("Flip up since scrollbars : "+(b+130)+">"+(z+w));
document.getElementById(arg).style.top='';
document.getElementById(arg).style.bottom=(d-15)+'px';
document.getElementById(arg).style.display='block';
} else if (e=="top") {
//alert(e);
document.getElementById(arg).style.top='';
document.getElementById(arg).style.bottom=(d-15)+'px';
document.getElementById(arg).style.display='block';
} else {
document.getElementById(arg).style.bottom='';
document.getElementById(arg).style.top=c+15+'px';
document.getElementById(arg).style.display='block';
}
//alert("bottom: "+document.getElementById(arg).style.bottom+" and top is "+document.getElementById(arg).style.top);
}

function checkAll(arg) {
for (i=0;i<arg;i++) {
var j = "document.compform.id"+(i+1);
eval(j+".checked=true");
}
}

function unCheckAll(arg) {
for (i=0;i<arg;i++) {
var j = "document.compform.id"+(i+1);
eval(j+".checked=false");
}
}

function openTerms() {
window.open('http://www.ecollegecribs.com/terms.php','terms','width=640,height=480,scrollbars=yes,toolbar=no,location=no,copyhistory=no,resizable=yes');
}
function openSignTerms() {
window.open('http://www.ecollegecribs.com/terms.php?signup=1','terms','width=640,height=480,scrollbars=yes,toolbar=no,location=no,copyhistory=no,resizable=yes');
}

function focusLogin() {
if (document.forms.loginf) {
document.forms.loginf.emaillogin.focus();
}
}

