/* Job.com Main Scripts */

// Popup Window
function popWin(htURL) 
{
 window.open('/load.job/pop/inc='+htURL,'JobPop','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=450');
}

// Help Window Popup
htPage = "";
function helpWin(htPage) {
    window.open('/content/help/?ht='+htPage+'','JobHelp','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=550,height=450');
}

// Popup Print Window
function printWin(htURL) 
{
    var prtwin = window.open('/load.job/pop/inc='+htURL,'JobPop','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=650,height=450');
	prtwin.print();
}

// Popup Transaction Window
function transWin(htURL,htID) 
{
 window.open('/load.job/pop/inc='+htURL+'/trans='+htID+'/','JobPop','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=450');
}

// Popup Window sized special for CVV2 pop
function cvvWin(htURL) 
{
 window.open('/load.job/pop/inc='+htURL,'JobPop','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=750');
}
//Text field counter
function textCounter(field, countfield, maxlimit) 
{
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else 
		countfield.value = maxlimit - field.value.length;
}

// Toggle DIV display property
function showDIV(objDiv)
{
   var myElement = document.getElementById(objDiv); 
   if (objDiv)
   {
	   if (myElement.style.display == "none")
	       myElement.style.display = "";
	   else
	       myElement.style.display = "none";
   }
}

//  Toggle Block Element with Folder (open/close) Icons
function togFldBlock(objBlock,objImage)
{
   var myElement = document.getElementById(objBlock,objImage);    
   if (myElement.style.display == "none")
   {
       myElement.style.display = "block";
       objImage.src = "/images/icons/ico-sm-fldopen.gif";
   }
   else
   {
       myElement.style.display = "none";
       objImage.src = "/images/icons/ico-sm-fldclose.gif";
   }
}

// Toggle DIV display property between 2 DIVs
function toggleCCDiv(showDiv)
{
   var oldCC = document.getElementById("oldCCdisplay"); 
   var newCC = document.getElementById("newCCdisplay"); 
   if (showDiv == 1)
   {
	   oldCC.style.display = ""; 
	   newCC.style.display = "none";
   } else {
	   oldCC.style.display = "none";
	   newCC.style.display = "";
   }
}

// Hide buttons to prevent multiple submits
function disableButtons()
{
	document.getElementById("buttonDiv").style.visibility="hidden";
}
