

function CheckValidationPromotionAdd()
{
	
   if(document.getElementById("_ctl0_ddlClinic").value=='--Select Practice--')
	{
		alert('Please Select Practice!');
		document.getElementById("_ctl0_ddlClinic").focus();
		return false;
	}	
	if(fnTrim(document.getElementById("_ctl0_txtTitle").value)=='')
	{
		alert('Please Enter Promotion Title !');
		document.getElementById("_ctl0_txtTitle").focus();
		document.getElementById("_ctl0_txtTitle").value='';
		return false;
	}
	
	if(document.getElementById("_ctl0_txtFCKEditorDescription").value!='' )
					{
						var data =document.getElementById("_ctl0_txtFCKEditorDescription").value;
						var len = data.length;
						if (len > 570)
						{
							alert('Description Main should be less than or equal to 570 characters' );
							document.getElementById("_ctl0_txtFCKEditorDescription").focus();
							return false;
						}
					}
	return true;
}
function OffersModify()
{
	if(fnTrim(document.getElementById("_ctl0_txtTitle").value)=='')
	{
		alert('Please Enter Offer Title !');
		document.getElementById("_ctl0_txtTitle").focus();
		document.getElementById("_ctl0_txtTitle").value='';
		return false;
	}
	return true;
}

function OffersAdd()
{
     if(document.getElementById("_ctl0_ddlPractice").value=='--Select Region--')
	{
		alert('Please Select Region!');
		document.getElementById("_ctl0_ddlPractice").focus();
		return false;
	}
   	
   	if(fnTrim(document.getElementById("_ctl0_txtTitle").value)=='')
	{
		alert('Please Enter Offer Title !');
		document.getElementById("_ctl0_txtTitle").focus();
		document.getElementById("_ctl0_txtTitle").value='';
		return false;
	}
	
	return true;
}


function CheckValidationPromotionModify()
{
	
	/*if(document.getElementById("_ctl0_ddlStateName").value=='--Select State--')
	{
		alert('Please Select State Name!');
		document.getElementById("_ctl0_ddlStateName").focus();
		return false;
	}
	if(document.getElementById("_ctl0_ddlCityName").value=='---Select City---')
	{
		alert('Please Select City Name!');
		document.getElementById("_ctl0_ddlCityName").focus();
		return false;
	}
if(document.getElementById("_ctl0_ddlClinic").value=='--Select Practice--')
	{
		alert('Please Select Practice!');
		document.getElementById("_ctl0_ddlClinic").focus();
		return false;
	}
	if(document.getElementById("_ctl0_ddlTitle").value=='--Select Title--')
	{
		alert('Please Select Promotion Title!');
	 	document.getElementById("_ctl0_ddlTitle").focus();
		return false;
	}*/
	if(fnTrim(document.getElementById("_ctl0_txtTitle").value)=='')
	{
		alert('Please Enter Promotion Title!');
		document.getElementById("_ctl0_txtTitle").focus();
		document.getElementById("_ctl0_txtTitle").value='';
		return false;
	}
	return true;
}


function CheckValidationPromotionPreview()
{
	if(document.getElementById("_ctl0_ddlStateName").value=='--Select State--')
	{
		alert('Please Select State Name!');
		document.getElementById("_ctl0_ddlStateName").focus();
		return false;
	}
	if(document.getElementById("_ctl0_ddlCityName").value=='---Select City---')
	{
		alert('Please Select City Name!');
		document.getElementById("_ctl0_ddlCityName").focus();
		return false;
	}
if(document.getElementById("_ctl0_ddlClinic").value=='--Select Practice--')
	{
		alert('Please Select Practice!');
		document.getElementById("_ctl0_ddlClinic").focus();
		return false;
	}
	if(document.getElementById("_ctl0_ddlTitle").value=='--Select Title--')
	{
		alert('Please Select Promotion Title!');
		document.getElementById("_ctl0_ddlTitle").focus();
		return false;
	}
	if(fnTrim(document.getElementById("_ctl0_txtTitle").value)=='')
	{
		alert('Please Enter Promotion Title!');
		document.getElementById("_ctl0_txtTitle").focus();
		document.getElementById("_ctl0_txtTitle").value='';
		return false;
	}
	return true;
}

function CheckValidationPromotionAdd1()
{
	
   if(document.getElementById("_ctl1_ddlClinic").value=='--Select Practice--')
	{
		alert('Please Select Practice!');
		document.getElementById("_ctl1_ddlClinic").focus();
		return false;
	}	
	if(fnTrim(document.getElementById("_ctl1_txtTitle").value)=='')
	{
		alert('Please Enter Promotion Title !');
		document.getElementById("_ctl1_txtTitle").focus();
		document.getElementById("_ctl1_txtTitle").value='';
		return false;
	}
	
	if(document.getElementById("_ctl1_txtFCKEditorDescription").value!='' )
					{
						var data =document.getElementById("_ctl0_txtFCKEditorDescription").value;
						var len = data.length;
						if (len > 570)
						{
							alert('Description Main should be less than or equal to 570 characters' );
							document.getElementById("_ctl0_txtFCKEditorDescription").focus();
							return false;
						}
					}
	return true;
}

		function CheckValidationPromotionPreview1()
		{
			
		if(document.getElementById("_ctl1_ddlClinic").value=='--Select Practice--')
			{
				alert('Please Select Practice!');
				document.getElementById("_ctl1_ddlClinic").focus();
				return false;
			}
			
			if(fnTrim(document.getElementById("_ctl1_txtTitle").value)=='')
			{
				alert('Please Enter Promotion Title!');
				document.getElementById("_ctl1_txtTitle").focus();
				document.getElementById("_ctl1_txtTitle").value='';
				return false;
			}
			return true;
		}
		
		
		function CheckValidationAssign()
		{
			
		   if(document.getElementById("_ctl1_ddlPracticeOffers").value=='--Select Practice--')
			{
				alert('Please Select Practice!');
				document.getElementById("_ctl1_ddlPracticeOffers").focus();
				return false;
			}
			
			var i;
			var checkCount=0;
			for(i=0; i < Form1.elements.length; i++)
			{
             if(Form1.elements[i].type == "checkbox")
                 if (Form1.elements[i].checked)
                    checkCount++;
                       
				if (checkCount > 1)
				{
					alert("Multiple checkboxes checked !");
					return false;
				}
           
			}
					
			if (checkCount == 0)
				{
				alert("Select a checkbox !");
				return false;
				}    
			/*if(document.getElementById("_ctl1_dgRegionalOffers__ctl3_chkSelect").checked==false)
			{
				alert('Please Select CheckBox!');
				return false;   
			}*/
			  
			return true;
		}
		
		function CheckValidationAssign1()
		{
			
		if(document.getElementById("_ctl0_ddlPracticeOffers").value=='--Select Practice--')
			{
				alert('Please Select Practice!');
				document.getElementById("_ctl0_ddlPracticeOffers").focus();
				return false;
			}
			
			var i;
			var checkCount=0;
			for(i=0; i < Form1.elements.length; i++)
			{
            if(Form1.elements[i].type == "checkbox")
                if (Form1.elements[i].checked)
                    checkCount++;
            
            if (checkCount > 1)
            {
                alert("Multiple checkboxes checked !");
                return false;
            }
        }
        
        if (checkCount == 0)
        {
            alert("Please select a checkbox !");
            return false;
        }    
		
				
			return true;
		}
		
        


   function OpenWindowDetailByPromotionId(PromotionId)
   {
	//alert(PromotionId);
	var URL = '../Clinic/PromotionDescription.aspx?PromotionId='+PromotionId;
	var WindowName = "about_blank";
	var Features = "location=top,toolbar=no,menubar=no,resizable=no,scrollbars=yes,width=400,height=350";
	window.open(URL,WindowName,Features);
}

function OpenWindowDetailForSpecialPromotion(PromotionId)
{
	//alert(PromotionId);
	var URL = 'Test1.aspx?PromotionId='+PromotionId;//PromotionDescription
	var WindowName = "about_blank";
	var Features = "location=top,toolbar=no,menubar=no,resizable=no,scrollbars=yes,width=400,height=350";
	window.open(URL,WindowName,Features);
}

function OpenWindowDetailForSpecialPromotionByPromotionId(PromotionId)
{
	//alert(PromotionId);
	var URL = '../SpecialOffersDescription.aspx?PromotionId='+PromotionId;//PromotionDescription
	var WindowName = "about_blank";
	var Features = "location=top,toolbar=no,menubar=no,resizable=no,scrollbars=yes,width=400,height=350";
	window.open(URL,WindowName,Features);
}

function OpenWindowDetail(ClinicId)
{
	var URL='PromotionDetails.aspx?ClinicId='+ClinicId;
	var WindowName = "about_blank";
	var Features = "location=top,toolbar=no,menubar=no,resizable=no,scrollbars=yes,width=400,height=350";
	window.open(URL,WindowName,Features);
	
}
 
//error in function check later
/*function OpenWindowSpecialOfferPrint(ClinicId)
{
	var URL='PrintSpecialOffer.ascx?ClinicId='+ClinicId +&PromotionId;
	var WindowName = "about_blank";
	var Features = "location=top,toolbar=no,menubar=no,resizable=no,scrollbars=yes,width=500,height=450";
	window.open(URL,WindowName,Features);
	
}*/

function print()
{
	window.print();
}

