// JavaScript Document
var HttpPath = 'http://localhost/banillaV2/';
//var HttpPath = 'http://'+location.host+'/';

function getPageHeight() {
	var ThisPageHeight = document.getElementById('pagewrapper').offsetHeight;
  	return ThisPageHeight;
}
function generatepassword(length) {
  chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  pass = "";
  for(x=0;x<length;x++)
  {
    i = Math.floor(Math.random() * 62);
    pass += chars.charAt(i);
  }
  document.getElementById('passwd').value = pass;
}

function openPopup(thediv) {
	document.getElementById(thediv).style.display = 'block';
	noPix = getPageHeight() +'px';
	document.getElementById('blanket').style.height = noPix;
	document.getElementById('popupboxholder').style.display = 'block';
	document.getElementById('popupboxfixer').style.display = 'block';
	document.body.style.overflow="hidden";
}
function closePopup(thediv) {
	document.getElementById(thediv).innerHTML= '';	
	document.body.style.overflow="auto";
	document.getElementById(thediv).style.display = 'none';
	document.getElementById('popupboxholder').style.display = 'none';
	document.getElementById('popupboxfixer').style.display = 'none';
	document.getElementById('blanket').style.display = 'none';
}
function resizewin(thediv,wt,ht) {
	document.getElementById(thediv).style.width = wt+'px';
}
function loadPage(pagetoload) {
    $('#floatbox').html('<img src="' + HttpPath + 'Assets/Img/Backoffice/loading.gif" />')
    $("#floatbox").load(pagetoload)
}

function loadWindow(thediv,pagetoload) {
    $('#'+thediv).html('<img src="' + HttpPath + 'Assets/Img/Backoffice/loading.gif" />')
    $('#'+thediv).load(pagetoload)
}
function closebox(divid) {
	document.getElementById(divid).innerHTML= '';	
}
function overWriteDiv(divid) {
	document.getElementById(divid).innerHTML= '';	
}
function loadtitle(pTitle) {
	document.getElementById('floatboxtitle').innerHTML = pTitle;
}
function openpopup(linkid) {
	document.getElementById(linkid).style.backgroundImage = 'url(' + HttpPath + 'Assets/Img/SideMenuSelected.png)';
	document.getElementById(linkid).style.color = '#333';
	document.getElementById('floatbox').style.visibility = 'visible';
}
function closepopup() {
var thedivs = document.getElementsByTagName('a');
for (x=0;x<thedivs.length;x++){
   if(thedivs[x].id.substr(0,5)=='popup'){
       thedivs[x].style.backgroundImage = 'url(' + HttpPath + 'Assets/Img/SideMenuBack.png)';
       thedivs[x].style.color = '#EA7A00';
   }
}
	document.getElementById('floatbox').style.visibility = 'hidden';
}


