function popup(url,width,height,scroll) {

   if(width == undefined) {
     var width ='600';
   }

   if(height == undefined) {
     var height='920';
   }

   if(url == '') { alert("No Url Passed"); return false; }
   var features = 'directories=no,menubar=no,status=no,scrollbars=yes,titlebar=no,toolbar=no,width=' + width +',height=' + height +'';
   var mypopup = window.open(url, 'SolarCashInput', features);
}


function makezip(gid,rawzip) {

if(gid == 'doit') {

document.getElementById('loading').innerHTML = '<TABLE border=1 width=290 cellpadding=0 cellspacing=0><TR><TD align=center bgcolor=white height=90 width=290><CENTER><img height=30 width=30 src=/images/loading.gif> \
<small><font color=black>Preparing Your ZipFile This May Take Awhile.<BR>Seriously, like maybe go for coffee.</font></small></CENTER></TD></TR></TABLE>';

mwidth = document.getElementById('mwidth').value;
mheight = document.getElementById('mheight').value;
quality = document.getElementById('quality').value;
gid = document.getElementById('gid').value;

var xmlHttp = getHTTPObject();
if (xmlHttp == null) { return; }
var url = "/tools/makezip.php?gid=" + gid + "&rawzip=" + rawzip + "&mwidth=" + mwidth + "&quality=" + quality + "&mheight=" + mheight;

xmlHttp.onreadystatechange = function () {

if (xmlHttp.readyState == 4) {
 results=xmlHttp.responseText;
  document.getElementById('loading').innerHTML = results;
  execScripts(results);
}  };

xmlHttp.open("GET", url, true);
xmlHttp.send(null);

} else {

document.getElementById('zipcontrol').innerHTML = '<form><BR><TABLE cellpadding=0 width=760 cellspacing=0 border=1><TR><TD class=fade2 align=center><TABLE width=790 cellpadding=2 cellspacing=0 border=0 class=fade2><TR> \
<TD align=right width=400>Max Picture Width :</TD><TD><input class=btn style=\'width:40px;\' id=\'mwidth\' type=text value=\'800\'></TD><TD rowspan=5 align=center width=320><div id=loading> \
<Table><TR><TD width=300 class=fade><B>C</B>ustomize Your Sizes - Shave minutes off your gallery prep time. Get What You Want Fast!!!</TD></TR></TABLE> \
</div></TD></TR><TR><TD align=right>Max Picture Height :</TD> \
<TD align=left><input class=btn id=mheight type=text style=\'width:40px;\' class=btn value=\'800\'></TD></TR> <TR> \
<TR><TD align=right>Jpeg Quality Level :</TD><TD align=left><input class=btn id=quality type=text style=\'width:40px;\' class=btn value=\'85\'></TD></TR> \
<TD colspan=2 align=center><input type=button class=btn onclick=\'makezip(\"doit\");\' value=\'Make This Zip File\'> \
<input type=button class=btn onclick=\'makezip(\"doit\",\"true\");\' value=\'Download Original Zip File\'><input type=hidden id=gid value='+gid+'> \
<BR><small>Gallery Identifier '+gid+'</small></TD></FORM></TR></TABLE></TD></TR></TABLE>';
};


};

function showanim(cycle) {
 if(cycle == 'on') {
  document.getElementById('loading').innerHTML = '<CENTER><img height=30 width=30 src=/images/loading.gif><BR><small><font color=black>Loading One Sec..</font></small></CENTER>';
 } else {
  document.getElementById('loading').innerHTML = 'jjjjjjjjjjjjjjjjjjjjj';
 }
};

function bannerlist() {
  site = document.getElementById('site').value;
  nudity = document.getElementById('nudity').value;
  sizes = document.getElementById('sizes').value;
  args = "site=" + site + "&nudity=" + nudity + "&sizes=" + sizes;
  loadfilteredtools('banners.php','loadfilteredsites','',args);
}

function hostedlist() {
  site = document.getElementById('hlist1').value;
  thumbsize = document.getElementById('hlist2').value;
  nudity = document.getElementById('hlist3').value;
  target = document.getElementById('hlist4').value;
  args = "site=" + site + "&target=" + target + "&nudity=" + nudity + "&thumbsize=" + thumbsize;
  loadfilteredtools('hostedlist.php','loadfilteredsites','',args);
}

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_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}

function GenerateLink(){
  document.getElementById("textarea1").value="" + document.getElementById("selectformat1").value + document.getElementById("selectformat2").value + document.getElementById("selectformat3").value + document.getElementById("selectformat4").value + document.getElementById("selectformat5").value + document.getElementById("selectformat6").value + document.getElementById("selectformat7").value + document.getElementById("selectformat8").value + document.getElementById("selectformat9").value +"";                                                                                                  
}


function loadpotds() {

    site =  document.getElementById("selectsite").value;
    thumbsize =  document.getElementById("thumbsize").value;
    ccbill =  document.getElementById("ccbillcode").value;

    var xmlHttp = getHTTPObject();

    if (xmlHttp == null) {
     return;
    }

    var url = "/tools/loadpotds.php?site=" + site + "&thumbsize=" + thumbsize + "&ccbill=" + ccbill;

    xmlHttp.onreadystatechange = function () {   

    if (xmlHttp.readyState == 4) { 
       results=xmlHttp.responseText; 
       document.getElementById('potdoutput').innerHTML = results; 
       execScripts(results); 
    }  };

    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
 }
