// Start of Show Hide Content

/************************************************************************************************************
(C) www.dhtmlgoodies.com, November 2005
************************************************************************************************************/

var dhtmlgoodies_slideSpeed = 30;	// Higher value = faster
var dhtmlgoodies_timer = 10;	// Lower value = faster

var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;
function showHideContent(e,inputId)
{
	if(dhtmlgoodies_slideInProgress)return;
	dhtmlgoodies_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);

	objectIdToSlideDown = false;
	
	if(!answerDiv.style.display || answerDiv.style.display=='none'){		
		if(dhtmlgoodies_activeId &&  dhtmlgoodies_activeId!=numericId){			
			objectIdToSlideDown = numericId;
			slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
		}else{
			
			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';
		
			
			slideContent(numericId,dhtmlgoodies_slideSpeed);
		}
	}else{
		slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
		dhtmlgoodies_activeId = false;
	}	
		
}

function slideContent(inputId,direction)
{
	
	var obj =document.getElementById('dhtmlgoodies_a' + inputId);
	var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);				
			}else{
				dhtmlgoodies_slideInProgress = false;
			}
		}else{
			dhtmlgoodies_activeId = inputId;
			dhtmlgoodies_slideInProgress = false;
		}
	}
}



function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='dhtmlgoodies_question'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtmlgoodies_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_a'+divCounter;	
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='dhtmlgoodies_answer_content';
			contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}		
	}	
}

// End of Show Hide Content

// Start of Plus Minus swap //

cc=0
function changeimage(myImage)
{
if (cc==0) 
{
cc=1
document.getElementById(myImage).src="../images/minus_sign.gif"
}
else
{
cc=0
document.getElementById(myImage).src="../images/plus_sign.gif"
}
}
// End of Plus Minus swap //



//Right side navigation menu functions

var myvar;
function menuinit() {
        document.getElementById('m1').style.display = 'none';
        document.getElementById('m2').style.display = 'none';
        document.getElementById('m3').style.display = 'none';
		document.getElementById('m4').style.display = 'none';
        document.getElementById('m5').style.display = 'none';
        document.getElementById('m6').style.display = 'none';
		document.getElementById('m7').style.display = 'none';
		document.getElementById('m8').style.display = 'none';
		document.getElementById('m9').style.display = 'none';
		document.getElementById('m10').style.display = 'none';
		document.getElementById('m11').style.display = 'none';
	document.getElementById('pm1').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm2').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm3').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm4').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm5').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm6').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm7').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm8').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm9').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm10').src = '../images/rightside_navi_arrow_up.gif';
	document.getElementById('pm11').src = '../images/rightside_navi_arrow_up.gif';
}
function menuexpand (i) {
        menuinit();
        if (myvar == i) {
		document.getElementById('p' + i).src = '../images/rightside_navi_arrow_up.gif';
		document.getElementById(i).style.display = 'none';
		myvar = '';
	}
        else {
		document.getElementById('p' + i).src = '../images/rightside_navi_arrow_down.gif';
		document.getElementById(i).style.display = 'block';
		myvar = i;
	}
}


// End of Right side navigation menu functions




function shimImage(img){
    img.src = "../images/clear.gif"
}

function checkinput(theForm)
{

  if (theForm.strSearch.value == "")
  {
    alert("Please enter a value for the \"Search\" field.");
    theForm.strSearch.focus();
    return (false);
  }
  
  if (theForm.strSearch.value.length < 2)
  {
    alert("Please enter more than one letter for the \"Search\" field.");
    theForm.strSearch.focus();
    return (false);
  }  
  
	return(true);
}

function CheckSearch(theForm)
{

  if (theForm.strSearch.value == "" && theForm.category.value == "-")
  {
    alert("Please either select a category, or enter a search term to find.");
    theForm.strSearch.focus();
    return (false);
  }
  
  
	return(true);
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function popUp(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
self.name = "mainWin"; }


function popUpCenteredWindow(strURL) {
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/2) - (122 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight = (window.screen.height/2) - (27 + 50); //half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strURL,"Window2","status=no,scrollbars=no,resizable=no,height=250,width=250,menubar=no,location=no,dependent=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
	win2.focus();
}

function popUpCenteredWindow2(strURL) {
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/4) - (122 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight = (window.screen.height/4) - (27 + 50); //half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strURL,"Window3","status=no,scrollbars=yes,resizable=no,height=400,width=430,menubar=no,location=no,dependent=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
	win2.focus();
}

function openWindow(strURL, iWidth, iHeight)
{
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/4) - (122 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight = (window.screen.height/4) - (27 + 50); //half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strURL,"Window2","status=no,scrollbars=no,resizable=no,height=" + iHeight + ",width=" + iWidth + ",menubar=no,location=no,dependent=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
	win2.focus();	
	return;
}

function openWindow2(strURL, iWidth, iHeight)
{
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/4) - (122 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight = (window.screen.height/4) - (27 + 50); //half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strURL,"Window2","status=no,scrollbars=yes,resizable=yes,height=" + iHeight + ",width=" + iWidth + ",menubar=no,location=no,dependent=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
	win2.focus();	
	return;
}

function openWindow3(strURL, iWidth, iHeight)
{
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/4) - (122 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight = (window.screen.height/4) - (100 + 50); //half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strURL,"Window4","status=no,scrollbars=yes,resizable=no,height=" + iHeight + ",width=" + iWidth + ",menubar=no,location=no,dependent=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
	win2.focus();	
	return;
}




// This funtion enables combo box navigation and close the POP window itself
function quickNav() {
	var page = document.indexForm.navIndex.value;
	var url = "barcode_catalog_" + page +  ".asp";
	document.location = url;
}
function closeWin() {
	window.close();
}

function foreground(url)
{
	b = window.open(url, 'b');
	b.focus();
}


// This funtion enables to pass the link to parent window and close itself
function forwardToShipping(url){
	self.opener.document.location = url
	window.close()
}

// This funtion enables to pass the link to parent window and close itself
function forwardLink(url){
	//document.open(url)
	window.close()
}




// Demo Form Validator //

function FrontPage_Form1_Validator(theForm)
{

  if (theForm.txtBillFirstName.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.txtBillFirstName.focus();
    return (false);
  }

  if (theForm.txtBillLastName.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.txtBillLastName.focus();
    return (false);
  }

  if (theForm.txtBillCompanyName.value == "")
  {
    alert("Please enter a value for the \"Company Name\" field.");
    theForm.txtBillCompanyName.focus();
    return (false);
  }

  if (theForm.txtBillAddress1.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.txtBillAddress1.focus();
    return (false);
  }

  if (theForm.txtBillCity.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.txtBillCity.focus();
    return (false);
  }

  if (theForm.txtBillCountry.value == "")
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.txtBillCountry.focus();
    return (false);
  }
  
if (theForm.txtBillCountry.value == "USA"){

  if (theForm.txtBillState.value == "")
  {
    alert("Please enter a value for the \"State\" field.");
    theForm.txtBillState.focus();
    return (false);
  }

  if (theForm.txtBillState.value.length > 2)
  {
    alert("Please enter at most 2 characters in the \"State\" field.");
    theForm.txtBillState.focus();
    return (false);
  }

  if (theForm.txtBillZip.value == "")
  {
    alert("Please enter a value for the \"Zip Code\" field.");
    theForm.txtBillZip.focus();
    return (false);
  }

  if (theForm.txtBillZip.value.length > 9)
  {
    alert("Please enter at most 9 characters in the \"Zip Code\" field.");
    theForm.txtBillZip.focus();
    return (false);
  }

}

  if (theForm.txtBillPhone.value == "")
  {
    alert("Please enter a value for the \"Phone\" field.");
    theForm.txtBillPhone.focus();
    return (false);
  }

  if (theForm.txtEmail.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.txtEmail.focus();
    return (false);
  }

if(!check_email(theForm.txtEmail.value)){

	alert("Please enter a valid email address.");
	theForm.txtEmail.focus(); 
	// if the browser is Netscape 6 or IE
		
	if(document.all || document.getElementByID){
		// change the color of text field
		theForm.txtEmail.style.background = "aliceblue";
	}
		
// make sure the form is not submitted
	return false;
}

	
return (true);


}

function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
		return (false);
		}	
	} 

	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
			
		if (!e.match(re) && e.match(re_two)) {
		return (-1);		
		} 
	}
}


// End of Demo Form Validator //


// Check Info Request Form //

function checkform1 ( form )
{


  // ** START **
  
if (form.FirstName.value == "") {
    alert( "Please enter your First Name." );
    form.FirstName.focus();
    return false ;
  }
  
if (form.LastName.value == "") {
    alert( "Please enter your Last Name." );
    form.LastName.focus();
    return false ;
  }
  
if (form.Email.value == "") {
    alert( "Please enter your email address." );
    form.Email.focus();
    return false ;
  }
  
if (form.DayTimePhoneNumber.value == "") {
    alert( "Please enter your Phone Number." );
    form.DayTimePhoneNumber.focus();
    return false ;
  }


  

  
  // ** END **
  return true ;
}


// End of Check Info Request Form //


// Check Max Award Nimination Form //

function checkform2 ( form )
{


  // ** START **
  
if (form.YourName.value == "") {
    alert( "Please enter your Name." );
    form.YourName.focus();
    return false ;
  }
  
if (form.CIOName.value == "") {
    alert( "Please enter your CIO's Name." );
    form.CIOName.focus();
    return false ;
  }
  
if (form.CompanyName.value == "") {
    alert( "Please enter your Company Name." );
    form.CompanyName.focus();
    return false ;
  }
  
if (form.Email.value == "") {
    alert( "Please enter your email address." );
    form.Email.focus();
    return false ;
  }
if (form.CIOEmail.value == "") {
    alert( "Please enter your CIO's email address." );
    form.CIOEmail.focus();
    return false ;
  }
  
if (form.DayTimePhoneNumber.value == "") {
    alert( "Please enter your Phone Number." );
    form.DayTimePhoneNumber.focus();
    return false ;
  }
if (form.Extended1.value == "") {
    alert( "Tell us why your CIO should win the Max Impact Award." );
    form.Extended1.focus();
    return false ;
  }


  

  
  // ** END **
  return true ;
}


// End of Check Info Request Form //



function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//  End -->


