//Opens Custom Windows
//Help Window
var helpwindow;
//Terms and Conditions Window
var termswindow;
//Generic Blank Window
var blankwindow;


function popHelp(url) { //Help Window
	helpwindow=window.open(url,'Help','left=40, top=100, width=640, height=480, toolbar=yes, directories=no, location=no, status=no, menubar=yes, resizable=yes, scrollbars=yes');
	if (window.focus) {helpwindow.focus()}
}

function popTerms(url) { //Terms Window
	termswindow=window.open(url,'Terms','left=10, top=70, width=640, height=380, toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
	if (window.focus) {termswindow.focus()}
}

function popBlank(url) { //Generic Blank Window
	blankwindow=window.open(url,'Blank','left=0, top=0, width=800, height=600, toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes');
	if (window.focus) {blankwindow.focus()}
}

// Window Closer
function closeIt() {
    close();
}

// Style Swapper
function swapStyle(id, newClass) {
    ss = document.getElementById(id);
    ss.className = newClass;
}

// Style Swapper with Set Position
function swapStylePos(e, id, newClass) {
    ss = document.getElementById(id);
    ss.className = newClass;
    if (navigator.userAgent.indexOf("MSIE") >= 0) {
        ss.style.top = (e.clientY - 140) + "px";
    }
    else {
    	ss.style.top = (e.pageY - 140) + "px";
    }
}

//Confirmation Alert Box
function confirmation() {
    var answer = confirm("Are you sure you want to DELETE ALL?")
     if (answer){
        document.forms.myLoadList.deleteAll.value = 1;
        document.forms.myLoadList.submit();
        return true;
     }
    else
        return false;
}

function confirmationT() {
    var answer = confirm("Are you sure you want to DELETE ALL?")
     if (answer){
        document.forms.myTruckList.deleteAll.value = 1;
        document.forms.myTruckList.submit();
        return true;
     }
    else
        return false;
}

var checkflag = "false";
function check(field) {
  if (checkflag == "false") {
    if (!field.length) {
      field.checked = true;
    }
    for (i = 0; i < field.length; i++) {
      field[i].checked = true;
    }
    checkflag = "true";
    return false;
  }
  else {
    if (!field.length) {
      field.checked = false;
    }
    for (i = 0; i < field.length; i++) {
      field[i].checked = false;
    }
    checkflag = "false";
    return false;
  }
}

