function setPrint()
{
  if(document.getElementById('hdnPrintOption').value.length > 0)
   {
    if(document.getElementById('hdnPrintOption').value == 'PRINT')
      {
        if(document.getElementById('divWarning') != null)
			document.getElementById('divWarning').innerHTML = "WARNING!  COUPON NOT VALID UNLESS ACCOMPANIED BY FULL COUPON TEXT AND INSTRUCTIONS";
            window.print();
			document.getElementById('hdnPrintOption').value = "";         
      }
     else  if(document.getElementById('hdnPrintOption').value == 'NOPRINT')
      {
		window.alert(No_Print_availabale_ForOffer);
		window.close();       
      }
      else if(document.getElementById('hdnPrintOption').value == 'COUNTEXCEEDS')
      {
		window.alert(Print_CountExceed_Alert);
		window.close();
      }
   }
}


//Function to redirect to advertisers website through SAA
function GoToUrl(id)
{
	var ids;
	url= '../Customer/BluRouteClickThrough.aspx?id=' + id;			
	//window.open(url,'SuperAffiliateAgent','width=100,height=100,top=1,resizable=yes,scrollbars=1,status=1');
	window.open(url);
}
	
/*function checkMap()
{				   
	if(document.getElementById("hdnMap").value == "true" )
	{
		document.getElementById("divMap").className = "printonly" ;				
	}
	else
	{
		document.getElementById("divMap").className = "dontprint" ;					  
	}
}*/
function clearMessage(objMessage)
{
	var Message = document.getElementById(objMessage);
	Message.innerText="";  
}

/*function Fixfocus() 
{
	if (event.keyCode==13)
	{
		document.getElementById("btnSend").focus();
	}
}*/
	
function sendMail(objEmail,objOption, objFormPrint)
{
	var Option = document.getElementById(objOption);
	var FormPrint = document.getElementById(objFormPrint);
	if(!isEmpty(objEmail))
	{
		Option.value = "send";
		//alert(Option.value);
		//alert(objFormPrint);
		//alert("goin to submit");
		FormPrint.submit();
		alert('Email sent successfully');
	}
}

function printOffer(objOption, objFormPrint)
{
	var Option = document.getElementById(objOption);
	var FormPrint = document.getElementById(objFormPrint);
	if(window.confirm(Confirm_msg_ForOffer) == true )
	{
		Option.value = "print";
		FormPrint.submit();
	}
}

function isEmpty(objEmail)
{
	var Email = document.getElementById(objEmail);
	if(Email.value == "")
	{
		alert(Email_Check_Alert);
		Email.focus();
		return true;
	}
	else
	{
	if(!EvaluateMail(Email.value))				   
	{
		alert(EmailValid_Check_Alert);
		Email.focus();
		return true;
	}
	else
		return false ;
	}
}

function EvaluateMail(val)
{				
var rx = new RegExp("([\ ]*)([0-9a-zA-Z._]([-.\w]*[0-9a-zA-Z._])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})([\ ]*)$");
var matches = rx.exec(val);
return (matches != null && val == matches[0]);
}


function resizeWin()
{
var x,y;
x=document.getElementById("imgCoupon").clientWidth;
y=document.getElementById("imgCoupon").clientHeight;
window.resizeTo(x + 120, y + 330 ); 
	if(document.getElementById("divWarning") != null)
	{		
		document.getElementById("divWarning").style.width = x;
	}	
}

//FUNCTION TO CHANGE BUTTON APPEARANCE

function setFocus(objEmail)
{
	if (document.getElementById(objEmail)!=null)
	{
		document.getElementById(objEmail).focus(); 
	}
}

function winclose()
{
	window.close();
}

var message="";
///////////////////////////////////
function clickIE()
{
	if (document.all) 
	{
		(message);
		return false;
	}
}
function clickNS(e)
{
	if (document.layers||(document.getElementById&&!document.all))
	{
		if (e.which==2||e.which==3)
		{
			(message);
			return false;
		}
	}
}
if (document.layers) 
{
	document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
}
else
{
	document.onmouseup=clickNS;document.oncontextmenu=clickIE;
} 
document.oncontextmenu=new Function("return false")