//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
	{
	    var left = parseInt((screen.availWidth/2) - (width/2));
        var top = parseInt((screen.availHeight/2) - (height/2));        
    
		wnd = window.open( url,
					'_blank', 
					'height=' + height + ',width=' + width + ',location=no,status=no,menubar=no,scrollbars=no,resizable=no,toolbar=no,dialog=1,left=' + left + ',top=' + top + 'screenX=' + left + ',screenY=' + top);
	}

	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 HideBarreviewfields()
{

//var obj = document.getElementById("barfields");
var checkboxval=document.getElementById("Bar_review_student");

    if (checkboxval.checked==true) 
    {
     
    document.getElementById("State_barexam").disabled=false;
    document.getElementById("Planned_examdate").disabled=false;
    document.getElementById("any_other_barprogr").disabled=false;
    document.getElementById("repeat_firsttime").disabled=false;
    document.getElementById("tenure").disabled=false;
    
        
    } 
    if (checkboxval.checked==false)
    {
    
    document.getElementById("State_barexam").disabled=true;
    document.getElementById("State_barexam").options[0].selected=true;
    document.getElementById("Planned_examdate").disabled=true;
    document.getElementById("Planned_examdate").options[0].selected=true;
    document.getElementById("any_other_barprogr").disabled=true;
    document.getElementById("any_other_barprogr").options[0].selected=true;
    document.getElementById("repeat_firsttime").disabled=true;
    document.getElementById("repeat_firsttime").options[0].selected=true;
    document.getElementById("tenure").disabled=true;
    document.getElementById("tenure").options[0].selected=true;
    
    
	//obj.style.display = "none";
    }
}*/

function HideotherinterestDetails()
{

var obj = document.getElementById("areainterestid");
    if (obj.style.display=="block")
               {
                  obj.style.display="none";
                  document.getElementById("showinteresttext").innerHTML="Show >>";
                  
               }
     else
              {
                 obj.style.display="block";
                 document.getElementById("showinteresttext").innerHTML="Hide >>";
                 
              }
}

function HideCourseTaughtDetails()
{

var obj = document.getElementById("coursedetails");
    if (obj.style.display=="block")
               {
                  obj.style.display="none";
                  document.getElementById("showtext").innerHTML="Show >>";
                  
               }
     else
              {
                 obj.style.display="block";
                 document.getElementById("showtext").innerHTML="Hide >>";
                 
              }
}
function CareerTypeCheckBoxes(checkboxval,popup)
{
	var aCtype1 = document.getElementById("career_type1");
	var aCtype2 = document.getElementById("career_type2");
	var aCtype3 = document.getElementById("career_type3");
	var aCtype4 = document.getElementById("career_type4");
	var aGradMonth = document.getElementById("graduation_month");
	var aGradYear = document.getElementById("graduation_year");
	var aStateBar=document.getElementById("state_barexam");
	var aSchool=document.getElementById("current_school");
	var aPlannedExam=document.getElementById("planned_examdate");
	var aAnyOther=document.getElementById("any_other_barprogr");
	var aRepeat=document.getElementById("repeat_firsttime");
	var aTenure=document.getElementById("tenure");
	var aBarReview=document.getElementById("Bar_review_student");
	var aCompanyfirm=document.getElementById("company_firm");
	var aYearTeach=document.getElementById("year_teaching");
	var aCoursetaught=document.getElementById("coursetaughtlink");
	var aOtherint=document.getElementById("otherinterestlink");
	var aProftype1=document.getElementById("professor_type1");
	var aProftype2=document.getElementById("professor_type2");
	var aProftype3=document.getElementById("professor_type3");
	var aValidateProf1=document.getElementById("validate_professor1");
	var aValidateProf2=document.getElementById("validate_professor2");
	

  
	if ((checkboxval=='career_type3') && (aCtype3.checked==false))
	{
		aGradMonth.disabled=false;
		aGradYear.disabled=false;
		
	}
	if ((checkboxval=='career_type4') && (aCtype4.checked==false)) 
	{
		aGradMonth.disabled=false;
		aGradYear.disabled=false;
		
		
	}
	if ((checkboxval=='career_type3') && (aCtype3.checked==true))
	{
		aCtype1.checked=false;
		aCtype2.checked=false;
		aCtype4.checked=false;
		aGradMonth.options[0].selected=true;
		aGradYear.options[0].selected=true;
		aStateBar.options[0].selected=true;
		aAnyOther.options[0].selected=true;
		aPlannedExam.options[0].selected=true;
		aTenure.options[0].selected=true;
		aRepeat.options[0].selected=true;
		aGradMonth.disabled=true;
		aGradYear.disabled=true;
		aStateBar.disabled=true;
		aSchool.disabled=false;
		aPlannedExam.disabled=true;
		aAnyOther.disabled=true;
		aRepeat.disabled=true;
		aTenure.disabled=true;
		aBarReview.disabled=true;
		aCompanyfirm.disabled=true;
		aYearTeach.disabled=false;
		aProftype1.disabled=false;
		aProftype2.disabled=false;
		aProftype3.disabled=false;
		aValidateProf1.disabled=false;
		aValidateProf2.disabled=false;
		
		aCoursetaught.style.display="block";
		aOtherint.style.display="block";
		
	}
	if ((checkboxval=='career_type4') && (aCtype4.checked==true))
	{
		if (popup==true)
	 {
	    alert('We\'re sorry. Only professors qualify to receive examination copies for review. If you would like to purchase these products, click continue for a payment-required order. If your profile does not correctly indicate that you are a professor, you may edit it to reflect professor status. Note that all persons indicating they are professors on this website will be verified with the professor\'s law school by our sales staff. Thank You.');
	    }
		aCtype1.checked=false;
		aCtype2.checked=false;
		aCtype3.checked=false;
		aGradMonth.options[0].selected=true;
		aGradYear.options[0].selected=true;
		aStateBar.options[0].selected=true;
		aSchool.options[0].selected=true;
		aTenure.options[0].selected=true;
		aRepeat.options[0].selected=true;
		aPlannedExam.options[0].selected=true;
		aAnyOther.options[0].selected=true;
		aStateBar.disabled=true;
		aSchool.disabled=true;
		aPlannedExam.disabled=true;
		aAnyOther.disabled=true;
		aRepeat.disabled=true;
		aTenure.disabled=true;
		aBarReview.disabled=false;
		aCompanyfirm.disabled=false;
		aYearTeach.disabled=true;
		aGradMonth.disabled=true;
		aGradYear.disabled=true;
		aProftype1.disabled=true;
		aProftype2.disabled=true;
		aProftype3.disabled=true;
		aValidateProf1.disabled=true;
		aValidateProf2.disabled=true;
		
		
		if (document.getElementById("areainterestid").style.display=="block")
		{
		document.getElementById("areainterestid").style.display="none";
		document.getElementById("showinteresttext").innerHTML="Show >>";
		}
		document.getElementById("otherinterestlink").style.display="none";
		
		
         
        
        
        if (document.getElementById("coursedetails").style.display=="block")
		{
		document.getElementById("coursedetails").style.display="none";
		document.getElementById("showtext").innerHTML="Show >>";
		}
        aCoursetaught.style.display="none";
        
         
        
	    
        
         
       
	}
	if (checkboxval=='career_type2')
	{
		if (popup==true)
	 {
	    alert('We\'re sorry. Only professors qualify to receive examination copies for review. If you would like to purchase these products, click continue for a payment-required order. If your profile does not correctly indicate that you are a professor, you may edit it to reflect professor status. Note that all persons indicating they are professors on this website will be verified with the professor\'s law school by our sales staff. Thank You.');
	    }
		aCtype1.checked=false;
		aCtype3.checked=false;
		aCtype4.checked=false;
		aGradMonth.disabled=false;
		aGradYear.disabled=false;
		aStateBar.disabled=false;
		aSchool.disabled=false;
		aPlannedExam.disabled=false;
		aAnyOther.disabled=false;
		aRepeat.disabled=false;
		aTenure.disabled=false;
		aBarReview.disabled=false;
		aCompanyfirm.disabled=true;
	    aYearTeach.disabled=true;
	    aProftype1.disabled=true;
		aProftype2.disabled=true;
		aProftype3.disabled=true;
		aValidateProf1.disabled=true;
		aValidateProf2.disabled=true;
	
	
	if (document.getElementById("areainterestid").style.display=="block")
		{
		document.getElementById("areainterestid").style.display="none";
		document.getElementById("showinteresttext").innerHTML="Show >>";
		}
		document.getElementById("otherinterestlink").style.display="none";
	
	if (document.getElementById("coursedetails").style.display=="block")
		{
		document.getElementById("coursedetails").style.display="none";
		document.getElementById("showtext").innerHTML="Show >>";
		}
	    aCoursetaught.style.display="none";
		
		  
	}
	if (checkboxval=='career_type1')
	{
	
	if (popup==true)
	{
	     alert('We\'re sorry. Only professors qualify to receive examination copies for review. If you would like to purchase these products, click continue for a payment-required order. If your profile does not correctly indicate that you are a professor, you may edit it to reflect professor status. Note that all persons indicating they are professors on this website will be verified with the professor\'s law school by our sales staff. Thank You.');
	}
		aCtype2.checked=false;
		aCtype3.checked=false;
		aCtype4.checked=false;
		aGradMonth.disabled=false;
		aGradYear.disabled=false;
		aStateBar.disabled=true;
		aSchool.disabled=false;
		aPlannedExam.disabled=true;
		aAnyOther.disabled=true;
		aTenure.disabled=true;
		aRepeat.disabled=true;
		aBarReview.disabled=false;
		aCompanyfirm.disabled=true;
		aYearTeach.disabled=true;
		aProftype1.disabled=true;
		aProftype2.disabled=true;
		aProftype3.disabled=true;
		aValidateProf1.disabled=true;
		aValidateProf2.disabled=true;
		
		if (document.getElementById("areainterestid").style.display=="block")
		{
		document.getElementById("areainterestid").style.display="none";
		document.getElementById("showinteresttext").innerHTML="Show >>";
		}
		document.getElementById("otherinterestlink").style.display="none";
		
		
		if (document.getElementById("coursedetails").style.display=="block")
		{
		document.getElementById("coursedetails").style.display="none";
		document.getElementById("showtext").innerHTML="Show >>";
		}
       aCoursetaught.style.display="none";
		
		
	
       
	}
}
function popup_professor_message()
{
	var aCtype1 = document.getElementById("career_type1");
	var aCtype2 = document.getElementById("career_type2");
	var aCtype3 = document.getElementById("career_type3");
	var aCtype4 = document.getElementById("career_type4");
	var response;
	
	
	if ((aCtype4.checked==true) || (aCtype1.checked==true) || (aCtype2.checked==true))
	{
	 
	 alert('We\'re sorry. Only professors qualify to receive examination copies for review. If you would like to purchase these products, click continue for a payment-required order. If your profile does not correctly indicate that you are a professor, you may edit it to reflect professor status. Note that all persons indicating they are professors on this website will be verified with the professor\'s law school by our sales staff. Thank You.');
	 /*if (response)
	 {
	 alert('hi1');
	    return true;
	 }
	 else
	 {
	    return false;
	 }*/
	 
	}
}
