//cookie check for javascript enabled/disabled...
//if javascript is enabled the app will be able to read the correct value for cookie
document.cookie = 'javascript=true'

//Order processing display
var bCCFormSubmitted = false;

function submitCCForm()
{ 
	for(var i=0;i<document.forms.length;i++)
	{
		if(document.forms[i].name=='CCInfo')
		{
			document.forms[i].submit();
			bCCFormSubmitted = true;
			var btn = document.getElementById('clickButton');
			if(btn)
			{
				btn.src='/LegalEdUI/images/checkout/processing_blue.gif';
			}
		}
	}
}

function switchToProcessing(theImage)
{
	if(!bCCFormSubmitted)
	{
		theImage.src='/LegalEdUI/images/checkout/processing_blue.gif?1234';
		submitCCForm();
	}
}

function switchCursor(theImage)
{
	if (navigator.appVersion.indexOf("MSIE")!=-1)  // For IE
	{
		if(!bCCFormSubmitted)
		{
			theImage.style.cursor='hand';
			theImage.style.cursor='pointer';
		}
		else
		{
			theImage.style.cursor='wait';
		}
	}
	else										// For Other browsers
	{
		if(!bCCFormSubmitted)
		{
			theImage.style.cursor='pointer';
		}
		else
		{
			theImage.style.cursor='wait';
		}	
	}
}
//End Order processing display

//***********EditQuantity*************
//Created By: Mandeep
//Created date: 13Oct2009
//Description: Used in \HTMLTemplate\popupLoginStyle.html
//************************************
function EditQuantity()
{	
	window.document.basket_form.method = "Post";
	window.document.basket_form.action = "_editQty.asp"
	window.document.basket_form.submit();
}

//***********PopupForgetPassword*******
//Created By: Mandeep
//Created date: 13Oct2009
//Description: Used in \HTMLTemplate\popupLoginStyle.html
//************************************
function PopupForgetPassword()
{
	window.parent.location.href = "/login/forgotpassword/default.asp"
	self.close();
}

function PopupNotRegistered()
{
	window.parent.location.href = "/login/login.asp"
	self.close();
}

function replEscapeChar(strKeyword)	{
	if (strKeyword.indexOf("+")>0)
		//replace the + sign with the some other character and parse it back in the posted asp page.
		return strKeyword.replace("+","~");
	else
		return strKeyword;
}
	
function IsSpaceOnly(s) 
{
	var i;
	for(i=0; i<=s.length-1; i++)	{
		if ((s.charAt(i) != ' ')) {
			return false;
		}
	}
	return true;	
}
function trimit(s)
{
	
	while (s.length!=0)
	{
		s = s.replace(" ","");	
	}
	return s;
}

function popWindow( url, width, height, allowScroll )
{
	var wnd;
	var scrollYesNo;
	
	if(allowScroll==true)
	{
		wnd = window.open( url,
					'_blank', 
					'height=' + height + ',width=' + width + ',location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no'
					);
	}
	else
	{
		wnd = window.open( url,
					'_blank', 
					'height=' + height + ',width=' + width + ',location=no,menubar=no,scrollbars=no,resizable=no,toolbar=no'
					);
	}

	wnd.focus();	
} // popWindow

function popupTimeline()
{
    return popWindow( '../law_students/timeline.asp', 600, 315, true );
} // popTimeline()

function validateSignupForm( frm )
{
	if( frm.first_name.value == "" ||
	    frm.last_name.value == "" ||
	    frm.email.value == "" )
	{
	    alert( "Please enter your first and last name, and your email address." );
	    return false;
	}
	else
	{
	    return true;
	}
} // validateSignupForm()

function validateSignupForm( frm )
{
	if( frm.first_name.value == "" ||
	    frm.last_name.value == "" ||
	    frm.email.value == "" )
	{
	    alert( "Please enter your first and last name, and your email address." );
	    return false;
	}
	else
	{
	    return true;
	}
} // validateSignupForm()

function validateRequestForm( frm )
{
	if( frm.first_name.value == "" ||
	    frm.last_name.value == "" )
	{
	    alert( "Please enter your first and last name." );
	    return false;
	}
	else
	{
	    return true;
	}
} // validateRequestForm()

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

function customerTypeChange(customerType, frm)
{
	var hiddenElement;

	for(var i=0;i<document.forms.length;i++)
	{
		//alert(document.forms[i].name);
		if(document.forms[i].name=='profile')
		{	
			for (var j=0;j<document.forms[i].length;j++)
			{
			if(document.forms[i].elements[j].name=='customer_type_change')
			{
				document.forms[i].elements[j].value = 'true';
				break;
			}		
			}
			document.forms[i].submit();
		}
	}
}
function CareerTypeCheckBoxes(checkboxval)
{
	var aCtype1 = document.getElementById("career_type1");
	var aCtype2 = document.getElementById("career_type2");
	var aCtype3 = document.getElementById("career_type3");
	var aGradMonth = document.getElementById("graduation_month");
	var aGradYear = document.getElementById("graduation_year");


	if ((checkboxval=='career_type3') && (aCtype3.checked==false))
	{
		aGradMonth.disabled=false;
		aGradYear.disabled=false;
	}
	if ((checkboxval=='career_type3') && (aCtype3.checked==true))
	{
		aCtype1.checked=false;
		aCtype2.checked=false;
		aGradMonth.options[0].selected=true;
		aGradYear.options[0].selected=true;
		aGradMonth.disabled=true;
		aGradYear.disabled=true;
	}
	if (checkboxval=='career_type2')
	{
		aCtype1.checked=false;
		aCtype3.checked=false;
		aGradMonth.disabled=false;
		aGradYear.disabled=false;
	}
	if (checkboxval=='career_type1')
	{
		aCtype2.checked=false;
		aCtype3.checked=false;
		aGradMonth.disabled=false;
		aGradYear.disabled=false;
	}
}