/*
Name: comp_javascript.js
Last modified: June 19, 2005
*/


/* Function for opening a new HELP window */
function comp_help(PAGE,HGT,WDT)
{
window.open("http://www.cssdrive.com/compressor/help/"+PAGE,"findID","height="+HGT+",width="+WDT+",toolbar=0,status=0,resizable=1,scrollbars=1");
}


/* Function for selecting settings on advanced page */
function comp_preSelect() {
f=document.form1;
var mymode = "normal";
f.lines[1].checked="1"; 
var query = window.location.search.substring(1);

    if (query == "light") {
      mymode = "light";	 
    } else if (query == "super") {
      mymode = "super";
      f.lines[2].checked="2"; 
    } else {
      mymode = "normal";
    }
	
  for (var i = 0; i < f.elements.length; i++) {
    if(f.elements[i].type == 'checkbox'){

      myString = f.elements[i].id;
	  myRE = new RegExp(mymode);

	  if (myString.match(myRE))
   	    {
          f.elements[i].checked=1;
   	    }
	  else
   	    {
          f.elements[i].checked=0;
   	    }
    }
  }

}

/* This function asigns the current mode to the mymode variable */
function comp_whatMode(what) {
mymode = what;
}

/* This function redirects to the advanced page with default form settings for current mode */
function comp_go() {
window.location="compress_advanced.htm?"+mymode;
}