// JavaScript Document


$(document).ready(function () {
  var account_box = $('#myAccountDiv');
  var account_button = $('.my_account');
  var account_button_text = account_button.html();
						
  $('#myAccountDiv .menuForm').css('display', 'none');
  $('.my_account').bind('mousedown', function (e) {
    e.preventDefault();
    if(account_box.css('display') == 'none') {
    account_box.slideDown('slow', function () {
    $('#myAccountDiv .menuForm').fadeTo('fast',1);
    account_box.css('display', 'block');
   //$('#myAccountDiv .menuForm').css('display', 'block');
 });
     }else {
            account_box.slideUp('slow', function () {
            $('#myAccountDiv .menuForm').fadeTo('fast',0);
            account_box.css('display', 'none');
 //$('#myAccountDiv .menuForm').css('display', 'none');
          }); 
														 
 }
 });
							
 /*$('.my_account').bind('mouseout', function (e) {
 e.preventDefault();
 account_box.bind('blur', function() {
 setTimeout( function()
 {
 account_box.fadeOut('slow');
 }, 4000);
 });
 });
																				 
 																				 
 account_box.slideUp('slow', function () {
 account_box.css('display', 'none');
 $('#myAccountDiv .menuForm').css('display', 'none');
 });
 });*/
 });



NS4 = (document.layers) ? true : false;

function checkEnter(event)
{     
    var code = 0;
    
    if (NS4)
        code = event.which;
    else
        code = event.keyCode;
    if (code==13)
        submitTopForm();
}

$(document).ready(function(){
			 var listHeader = $('.serviceList');
			 var listDIV = $('.serviceList + div');
			
			listDIV.css('display', 'none');
			// listHeader.css('background', '#fff url(../images/icons/arrow_down_icon.png) 95% 50% no-repeat;');

 $(function () {
		 
			 listHeader.css('cursor', 'pointer');
			 listHeader.mouseover(function () {$(this).css('color', '#ff6600'); });
			 listHeader.mouseout(function () {$(this).css('color', 'inherit'); });
			 
			 listHeader.click(function () {
										//$(this).removeClass('serviceList');
										
									if($(this).next().css('display') == 'none') {
										listDIV.slideUp('fast');
									$(this).next().slideDown('fast');

                                    listHeader.css('background', 'none');
									listHeader.css('background', '#fff url(../images/icons/arrow_down_icon.png) 95% 50% no-repeat');
									$(this).css('background', '#efefef url(../images/icons/arrow_up_icon.png) 95% 50% no-repeat');
									// listDIV.slideDown('fast');
									 //listDIV.fadeIn('slow');
										}
										
										else if($(this).next().css('display') == 'block') {
										$(this).next().slideUp('fast');
									//$(this).css('background', 'none');
									$(this).css('background', '#fff url(../images/icons/arrow_down_icon.png) 95% 50% no-repeat');
										//listDIV.slideUp('fast');
										//listDIV.css('display', 'none')
										}
									 });
			 });
 })
 
 
 
 $(document).ready(function(){
		$('#accessRequestForm').formValidation({
				alias        : 'id'
				,required    : 'accept'
				,err_list    :    true
				,callback    : 'callback'
		});
});

function callback() {
	//return confirm("Click Submit to complete the process");
	return true;
}
 
 
 
 function addInputSubmitEvent(form, input) {
	input.onkeydown = function(e) {
		e = e || window.event;
		if (e.keyCode == 13) {
			form.submit();
			return false;
		}
	};
}

window.onload = function() {
	
	var form1 = document.getElementById('SignOn');
	var input1 = form1.getElementsByTagName('input');
	
	for (var i=0;i < input1.length;i++)
		addInputSubmitEvent(form1, input1[i]);
	
};
 
 
 

function getVar( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );

  if( results == null )
    return "";
  else
    return results[1];
}
