function KeyEnter_DoAction(fldName,evt,strLayerPostVal,strModalTypeCondition,frmObj) {

		evt = (evt) ? evt : window.event;

		if (evt.keyCode == 13 ) {

			if(strLayerPostVal=="" || strLayerPostVal=="undefined" || strLayerPostVal==null)

				strLayerPostVal = "";

			

			if(fldName=="LoginForm")

				CheckLogin(frmObj,strModalTypeCondition,'SubmitLogin',500,250,strLayerPostVal,'modalwindow/modalwindow.php');

			return false;

		} else {

			return true;

		}

	

	

	}

	

//////////////Common Variables



var LoadingStatus="<img src='"+SiteImagePath+"ajaxloaders/ajax_loader_small.gif'/>"; 

var ModalStaticContent='';

var ModalStaticContentTitle='';



////////////////////////////////////////////////////////Modal Window Related Functions ////////////////////////////////////////////

	messageObj = new DHTML_modalMessage();	

	messageObj.setShadowOffset(5);	

	

	function ShowModalWindow(ModalType,width,height,PostValues,AjaxFilename,AjaxCheckFormData,strValue) {


		if(ModalStaticContent!='') {

			messageObj.setModalStaticContentTitle(ModalStaticContentTitle);

			messageObj.setModalStaticContent(ModalStaticContent);

			ModalStaticContent='';

			ModalStaticContentTitle='';

			messageObj.setAjaxFileNames(AjaxFilename,AjaxCheckFormData);

			messageObj.setSource(ModalType);

			messageObj.setPostValues(PostValues,strValue);

			messageObj.setCssClassMessageBox(false);

			messageObj.setSize(width,height);

			messageObj.setShadowDivVisible(false);	// Enable shadow for these boxes

			messageObj.display();

		}

		else {

			ModalStaticContent='';

			ModalStaticContentTitle='';

			messageObj.setModalStaticContentTitle(ModalStaticContentTitle);

			messageObj.setModalStaticContent(ModalStaticContent);

			messageObj.setAjaxFileNames(AjaxFilename,AjaxCheckFormData);

			messageObj.setSource(ModalType);

			messageObj.setPostValues(PostValues,strValue);

			messageObj.setCssClassMessageBox(false);

			messageObj.setSize(width,height);

			messageObj.setShadowDivVisible(false);	// Enable shadow for these boxes

			messageObj.display();

		}

	

	}

	function AddCartLayer(objForm,strSubmitValue,id,Layer) {

		validate_form(objForm)

		if(!AddtoCart(objForm,id,Layer))

		return false;

		

	}

	function ShowModalWindowContent(ModalMasterID,ModalType,PostValues,AjaxFilename,AjaxCheckFormData)

	{

		

		var Filename=AjaxFilename;

		ModalMasterID_public=ModalMasterID;

		document.getElementById(ModalMasterID).innerHTML = '<table align="center" height="100%"><tr><td colspan="2" valign="middle"  height=30 >'+LoadingStatus+'</td></tr></table>';

		var success = function(t){ShowModalWindowContent_Complete(t,ModalMasterID,ModalType,PostValues,AjaxFilename,AjaxCheckFormData);}

		var failure = function(t){ShowOnFailure(t);}

		var url = Filename;

		var pars = '&ModalTypeCondition='+ModalType+'&PostValues='+PostValues;

		var myAjax = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});

	}

	function ShowModalWindowContent_Complete(t,ModalMasterID,ModalType,PostValues,AjaxFilename,AjaxCheckFormData)

	{

		var strValue = t.responseText;

		var strDisplay = strValue.split("|");

		if(strDisplay[1]=="LoginLayer")	{

			//alert(PostValues+"  --  "+AjaxFilename+"  --  "+AjaxCheckFormData)

			ShowModalWindow('ShowLogin',450,270,PostValues,'modalwindow/modalwindow.php');

		} else {

			document.getElementById(ModalMasterID).innerHTML =strDisplay[0];

		}

	}

	

	function closeMessage(RedirectCondition)

	{

		messageObj.close();

		if(RedirectCondition='AfterLogin') {

				var url=location.href;

				if(url ==SiteGlobalPath+'checkout.php')

					window.location.href=location.href;

		}

			

	}

	

	function ShowOnFailure(t) { alert(t); };

	

	//////////////////////////////////////////////////////// Ajax Form Validation ////////////////////////////////////////////



	function CheckFormData(value,BasicID,obj,fieldName,Condition,SubCondition,ErrorImgIdPostfix,ErrorTxtIdPostfix,FilenameFormCheck,FormName)

	{

		var FilenameFormCheck=SiteAjaxFolder+FilenameFormCheck;

		var success = function(t){CheckFormData_Complete(t,value,BasicID,obj,fieldName,Condition,SubCondition,ErrorImgIdPostfix,ErrorTxtIdPostfix,FilenameFormCheck,FormName);}

		var failure = function(t){ShowOnFailure(t);}

		var url = FilenameFormCheck;

		var pars = '&Condition='+Condition+'&Value='+value+'&fieldName='+fieldName+'&FormName='+FormName;

		var myAjax = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});

	}

	function CheckFormData_Complete(t,value,BasicID,obj,fieldName,Condition,SubCondition,ErrorImgIdPostfix,ErrorTxtIdPostfix,FilenameFormCheck,FormName)

	{

		var strLabelText = "";

		var strValue = t.responseText;

		var SpanID=BasicID+ErrorTxtIdPostfix; 

		var LabelImgID=BasicID+ErrorImgIdPostfix;

		if(strValue!=1) {

				var response=strValue.split("||");

				document.getElementById(LabelImgID).innerHTML	=ErrorInfoImg;

				document.getElementById(LabelImgID).className	='InValidClass';

				document.getElementById(SpanID).className		='LayerTdClassError';

				document.getElementById(SpanID).innerHTML		= response[1]+strLabelText;

		}

		else if(strValue==1) {

				var response=strValue.split("||");

				document.getElementById(LabelImgID).innerHTML	=SuccessInfoImg;

				document.getElementById(LabelImgID).className	='ValidClass';

				document.getElementById(SpanID).className		='LayerTdClass';

				document.getElementById(SpanID).innerHTML		= '&nbsp;';

		}

		

	}

	function fieldEnter(fldName,evt,strChkLabel,strChkLabelValue) {

		evt = (evt) ? evt : window.event;

		if (evt.keyCode == 13 ) {

			if(fldName=="username") {

			 return ForgotPasswordMail(document.forgotpass,'Layer')

			}

			if(fldName=="promcode") {

			 return Discount_Validate(document.c_form1)

			}

		}

	}

	function ForgotPasswordMail(objForm,Layer) {

		if(!forgopass(objForm,Layer))

		return false;

		else

		return true;

		

	}

	function Mailtofriend(objForm,id,Layer) {

	if(!validatetellafriend(objForm,id,Layer))

		return false;

		else

		return true;

	}

	function AddWishListCart(objForm,id,Layer) {

		if(!AddtoCart(objForm,id,Layer))

				return false;

				else

				return true;

	}

	

	function SendFeedBack(objForm,Layer) {

	if(!validatesendfeedback(objForm,Layer))

				return false;

				else

				return true;

    }

	function ShowLogin(formObj,Layer,ModalType,width,height,PostValues,AjaxFilename,AjaxCheckFormData,strValue) {

		var Filename= SiteAjaxFolder+AjaxFilename;

		var success = function(t){ShowModalWindowLoginContent_Complete(t,width,height,PostValues,AjaxFilename,AjaxCheckFormData,strValue,Layer);}

		var failure = function(t){ShowOnLoginFailure(t);}

		var url = Filename;

		var pars = '&ModalTypeCondition='+ModalType+'&PostValues='+PostValues+strValue;

		var myAjax = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});

	}

	

  function ShowModalWindowLoginContent_Complete(t,width,height,PostValues,AjaxFilename,AjaxCheckFormData,strValue,Layer) {

		var strValue = t.responseText;

		var strDisplay = strValue.split("|");

	 if(Layer == 'ShowLogin')	{ 

	 	if(strDisplay[0]=='Login'){

	  	alert("Invalid Email address or Password.The login details that you entered don't match")

	  	}	else	{

	  		closeMessage('AfterLogin');

	  		var locationhttp=location.href;

			var index = locationhttp.indexOf("registration.php");

			if(strDisplay[1]=="SecureCheckout")

				window.location.href='checkout.php';

 		 	else if (index > 0)

		 		window.location.href='final_checkout.php';

		 	else

	  			window.location.href=location.href;

	  			//document.getElementById('IsLoginId').innerHTML = "<a href='logout.php' class='LeftPanelText' >Logout</a>";

	 	}

	 } else {

		ShowModalWindow('AddToWishlist',500,250,PostValues,AjaxFilename)

	 }

  }

  function ShowOnLoginFailure() {

  }

  

  function ShowLoginOption(strimage){

	  if(document.getElementById('imageSubmit')){

		if(strimage=='login.gif') 

		{

			document.getElementById('imageSubmit').src="images/login.gif";

		}

		else 

			document.getElementById('imageSubmit').src="images/checkout.gif";

	  }

	}

