

$(document).ready(function() {    

  $("#submit-btn").hover(function () {

		$("#submit-btn").addClass("btn-submit-hover").removeClass("btn-submit-normal");
    
  }, function () {

		$("#submit-btn").addClass("btn-submit-normal").removeClass("btn-submit-hover");

  });

});

//###### anchorPreview
function anchorPreview()
{ var winH = $(window).height();
	var ancP = $("#anchorPreview").position();
  $(window).scrollTop(Math.max(0, ancP.top-10));
}

/*************************************/
//       imgChangeByName()
/*************************************/
function imgChangeByName(imgName, imgSrc)
{ try
  { if(document.images && imgName && imgSrc){
    document.images[imgName].src = imgSrc; }
  } catch(e) {}
}

/*************************************/
//       imgChangeByObj()
/*************************************/
function imgChangeByObj(oImg, imgSrc)
{ try
  { if(document.images && oImg && imgSrc){
    oImg.src = imgSrc;}
  } catch(e) {}

}


/***************************************/
//       ValidateEmail()
/***************************************/
function ValidateEmail(emailInput, inputTitle)
{	var theStr = new String(emailInput.value);
  var index = theStr.indexOf("@");
  var pindex = theStr.indexOf(".",index);

  if(inputTitle.length==0) inputTitle = "Email Address";

  if(theStr == "")
  { alert("Please enter [" + inputTitle + "].      ");
    emailInput.focus();
    return false;
  }
  else if(theStr.indexOf("@") <= 0)
  { alert("Please enter valid [" + inputTitle + "].      \n\n"
        + "( yourname@yourdomain.com )" );
    emailInput.focus();
    return false;
  }
  else if ( !((pindex > index+1) && (theStr.length > pindex+1)) )
  { alert("Please enter valid [" + inputTitle + "].      \n\n"
        + "( yourname@yourdomain.com )" );
    emailInput.focus();
    return false;
  }

	return true;
}//end validate email address

var popupWin;

/***************************************/
//           closePopup()
/***************************************/
function closePopup()
{ if(popupWin)
    popupWin.close();
}

/***************************************/
//         openPopupWindow()
/***************************************/
function openPopupWindow(addr, winwidth, winheight, ststus, leftpos, toppos, scrollbar, tool_bar)
{ closePopup();

	if(ststus != 'yes')
    ststus = 'no';
	if(scrollbar != 'yes')
    scrollbar = 'no';
	if(tool_bar != 'yes')
    tool_bar = 'no';

	if(!leftpos)
	{ var scrwidth  = screen.availWidth
    leftpos= (scrwidth/2) -(winwidth/2);
  }
  if(!toppos)
  { var scrheight = screen.availHeight
    toppos = (scrheight/2)-(winheight/2);
  }

  popupWin = window.open(
  addr
  , 'popupWin'
  , config='width='+winwidth
  +',height='+winheight
  +',left='+leftpos
  +',top='+ toppos
  +',modal=yes' 
  +',toolbar='+tool_bar+', menubar=no, '
  +',scrollbars='+scrollbar+', resizable=no, '
  +',location=no, directories=no, status=' + ststus );
  
  popupWin.focus();
}


/***************************************/
//       openPopupPage()
/***************************************/
function openPopupPage(dir)
{ 
	var winwidth  = 798
  var winheight = 379;
  
  openPopupWindow('/'+dir+'/popup/', winwidth, winheight, 'yes', '', '', 'yes');
}



/***************************************/
//       updateMenuStyleOn()
/***************************************/
function updateMenuStyleOn(menuObj)
{
	//alert(menuObj.firstChild.className)
	if(menuObj.className == "sub_main_menu_div"){
	menuObj.className = "sub_main_menu_div_on";
	menuObj.firstChild.className = "menu_left_main_on";
	}

	if(menuObj.className == "sub_main_menu_div1"){
	menuObj.className = "sub_main_menu_div_on";
	menuObj.firstChild.className = "menu_left_main_on";
	}
	
	
	//menuObj.className = objClassName;
}


/***************************************/
//       updateMenuStyleOff()
/***************************************/
function updateMenuStyleOff(menuObj, objOn)
{ 
	if(objOn == '0'){
	menuObj.className = "sub_main_menu_div";
	menuObj.firstChild.className = "menu_left_main";
	}


	if(objOn == '1' && menuObj.className != 'sub_main_menu_div_active'){
	menuObj.className = "sub_main_menu_div1";
	menuObj.firstChild.className = "menu_left_main";
	}
	

}


// Functions used by text fields to accept numbers only.
var IsDigit = ( function()
	{
		var KeyIdentifierMap =
		{
			End			: 35,
			Home		: 36,
			Left		: 37,
			Right		: 39,
			'U+00007F'	: 46		// Delete
		} ;

		return function ( e )
			{
				if ( !e )
					e = event ;

				var iCode = ( e.keyCode || e.charCode ) ;

				if ( !iCode && e.keyIdentifier && ( e.keyIdentifier in KeyIdentifierMap ) )
						iCode = KeyIdentifierMap[ e.keyIdentifier ] ;
				/*
				if(!
						( iCode >= 48 && iCode <= 57 )		// Numbers
						|| (iCode >= 35 && iCode <= 40)		// Arrows, Home, End
						|| iCode == 8						// Backspace
						|| iCode == 46						// Delete
						|| iCode == 9						// Tab				
					)
					alert('Please enter numbers only');
				*/
				
				return (
						( iCode >= 48 && iCode <= 57 )		// Numbers
						|| (iCode >= 35 && iCode <= 40)		// Arrows, Home, End
						|| iCode == 8						// Backspace
						|| iCode == 46						// Delete
						|| iCode == 9						// Tab
				) ;
			}
	} )() ;

