

<!-- Begin
var expDays = 0; // number of days the cookie should last


function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}
function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
var count = GetCookie('count');

if (count == null) {
count=1;
SetCookie('count', count);

//placeIt();
showIt();

}
else {
//count++;
SetCookie('count', count);
   }
}
//  End -->


function discountPop(){
showIt();	
	
}


var y1 =280;   // change the # on the left to adjuct the Y co-ordinate
(document.getElementById) ? dom = true : dom = false;

function hideIt() {
  if (dom) {document.getElementById("floatlayer").style.display='none';document.getElementById("txtBirdEmail").value='';}
  if (document.layers) {document.layers["floatlayer"].visibility='none';document.layers["floatlayer"].value} }

function showIt(prodimage,prodcode,productname) {




  if (dom) {
  	document.getElementById("floatlayer").style.display='';
  	document.getElementById("s1_txtHint").innerHTML="";
  	document.getElementById("s1_floatImage").innerHTML='<img src="/images/thumbs/'+prodimage+'" border="0" >';
  	document.getElementById("s1_floatProduct").innerHTML=decodeURI(productname);
  	document.getElementById("hdnAlertProd").value=prodcode;
  	document.getElementById("s1_hdnimg").value=prodimage;
  	document.getElementById("s1_hdnprodname").value=document.getElementById("s1_floatProduct").innerHTML;
  	//alert(document.getElementById("floatImage").innerHTML);
  	}
  if (document.layers) {
  	document.layers["floatlayer"].display='';
  	document.layers["s1_txtHint"].innerHTML="";
  	document.layers["s1_floatImage"].innerHTML='<img src="/images/'+prodimage+'" border="0" >';
  	document.layers["s1_floatProduct"].innerHTML=decodeURI(productname);
  	document.layers["hdnAlertProd"].value=prodcode;
  	document.layers["s1_hdnimg"].value=prodimage;
  	document.layers["s1_hdnprodname"].value=document.layers["s1_floatProduct"].innerHTML;
  	} 
  	
  	
  	(function($) {
            $.fn.extend({
                center: function(options) {
                    var options = $.extend({ // Default values
                        inside: window, // element, center into window
                        transition: 0, // millisecond, transition time
                        minX: 0, // pixel, minimum left element value
                        minY: 0, // pixel, minimum top element value
                        vertical: true, // booleen, center vertical
                        withScrolling: true, // booleen, take care of element inside scrollTop when minX < 0 and window is small or when window is big
                        horizontal: true // booleen, center horizontal
                    }, options);
                    return this.each(function() {
                        var props = { position: 'absolute' };
                        if (options.vertical) {
                            var top = ($(options.inside).height() - $(this).outerHeight()) / 2;
                            if (options.withScrolling) top += $(options.inside).scrollTop() || 0;
                            top = (top > options.minY ? top : options.minY);
                            $.extend(props, { top: top + 'px' });
                        }
                        if (options.horizontal) {
                            var left = ($(options.inside).width() - $(this).outerWidth()) / 2;
                            if (options.withScrolling) left += $(options.inside).scrollLeft() || 0;
                            left = (left > options.minX ? left : options.minX);
                            $.extend(props, { left: left + 'px' });
                        }
                        if (options.transition > 0) $(this).animate(props, options.transition);
                        else $(this).css(props);
                        return $(this);
                    });
                }
            });
        })(jQuery);

        $('#floatlayer').center();
  	
  	document.getElementById("txtBirdEmail").focus();
  }
  
function stringdecode(utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}






//<!--
floatX=10;
floatY=10;
layerwidth=200;
layerheight=130;
halign="center";
valign="center";
delayspeed=3;


NS6=false;
IE4=(document.all);
if (!IE4) {NS6=(document.getElementById);}
NS4=(document.layers);

function adjust() {

// START NN SPECIFIC CODE
 if ((NS4) || (NS6)) {
  if (lastX==-1 || delayspeed==0)
  {
   lastX=window.pageXOffset + floatX;
   lastY=window.pageYOffset + floatY;
  }
  else
  {
   var dx=Math.abs(window.pageXOffset+floatX-lastX);
   var dy=Math.abs(window.pageYOffset+floatY-lastY);
   var d=Math.sqrt(dx*dx+dy*dy);
   var c=Math.round(d/10);
   if (window.pageXOffset+floatX>lastX) {lastX=lastX+delayspeed+c;}
   if (window.pageXOffset+floatX<lastX) {lastX=lastX-delayspeed-c;}
   if (window.pageYOffset+floatY>lastY) {lastY=lastY+delayspeed+c;}
   if (window.pageYOffset+floatY<lastY) {lastY=lastY-delayspeed-c;}
  }
  if (NS4){
   document.layers['floatlayer'].pageX = lastX;
   document.layers['floatlayer'].pageY = lastY;
  }
  if (NS6){
   document.getElementById('floatlayer').style.left=lastX+'px';
   document.getElementById('floatlayer').style.top=lastY+'px';
  }
 }
// END NN SPECIFIC CODE


// START IE SPECIFIC CODE
 else if (IE4)
 {
  if (document.documentElement && document.documentElement.scrollTop){
   posNowX = document.documentElement.scrollLeft;
   posNowY = document.documentElement.scrollTop;
  } 
  else if (document.body){
   posNowX = document.body.scrollLeft;
   posNowY = document.body.scrollTop;
  }
  if (lastX==-1 || delayspeed==0)
  {
   lastX=posNowX + floatX;
   lastY=posNowY + floatY;
  }
  else
  {
   var dx=Math.abs(posNowX+floatX-lastX);
   var dy=Math.abs(posNowY+floatY-lastY);
   var d=Math.sqrt(dx*dx+dy*dy);
   var c=Math.round(d/10);
   if (posNowX+floatX>lastX) {lastX=lastX+delayspeed+c;}
   if (posNowX+floatX<lastX) {lastX=lastX-delayspeed-c;}
   if (posNowY+floatY>lastY) {lastY=lastY+delayspeed+c;}
   if (posNowY+floatY<lastY) {lastY=lastY-delayspeed-c;}
  }
  document.all['floatlayer'].style.posLeft = lastX;
  document.all['floatlayer'].style.posTop = lastY;
//alert(document.body.scrollTop+':'+document.scrollTop);
//  alert(document.all['floatlayer'].style.posTop+':'+lastY);
 } 
// END IE SPECIFIC CODE

 //setTimeout('adjust()',50);

}

function define()
{
if ((NS4) || (NS6)) 
{ 
if (halign=="left") {floatX=ifloatX};
if (halign=="right") {floatX=window.innerWidth-ifloatX-layerwidth-20};
if (halign=="center") {floatX=Math.round((window.innerWidth-270)/2)-Math.round(layerwidth/2)};
if (valign=="top") {floatY=ifloatY};
if (valign=="bottom") {floatY=window.innerHeight-ifloatY-layerheight};
if (valign=="center") {floatY=Math.round((window.innerHeight-200)/2)-Math.round(layerheight/2)};
}
if (IE4) 
{
		
 if (window.offsetWidth){
  theWidth = window.offsetWidth;
  theHeight = window.offsetHeight;
 }
 else if (document.documentElement && document.documentElement.offsetWidth)
 {
  theWidth = document.documentElement.offsetWidth;
  theHeight = document.documentElement.offsetHeight;
 }
 else if (document.body)
 {
  theWidth = document.body.offsetWidth;
  theHeight = document.body.offsetHeight;
 }


if (halign=="left") {floatX=ifloatX};
if (halign=="right") {floatX=theWidth-ifloatX-layerwidth-20}
if (halign=="center") {floatX=Math.round((theWidth-270)/2)-Math.round(layerwidth/2)}
if (valign=="top") {floatY=ifloatY};
if (valign=="bottom") {floatY=theHeight-ifloatY-layerheight}
if (valign=="center") {floatY=Math.round((theHeight-200)/2)-Math.round(layerheight/2)}
}
}
//-->


function chkAlertLogin(){
	strRemail=/^[\x09\]+[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@*.[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/ ;
	strEvalue=document.getElementById("txtBirdEmail").value;
   	strIndex=strEvalue.indexOf("@");
   	
	if (document.getElementById("txtBirdEmail").value=="") {
		alert("Please enter in your email address.");
		document.getElementById("txtBirdEmail").focus();
		return false;
			
	}
	else if(document.getElementById("txtBirdEmail").value.charAt(0)==' ')	
	{	
		alert("You have not entered this field properly.\nPlease remove the leading spaces");
		document.getElementById("txtBirdEmail").focus();
		return false;
	}
	else if((!strRemail.test(strEvalue)) || strIndex==-1)
   	{
      		alert ("Please enter in a valid email address.");
      		document.getElementById("txtBirdEmail").focus();
      		return false;
      		
	}
	else if(!echeck(strEvalue))
   	{
      		alert ("Please enter your email in the proper format");
      		document.getElementById("txtBirdEmail").focus();
      		return false;
    	}
	
	else
	{
	    //alert("praveen");
		//alertBird(document.getElementById("txtBirdEmail").value,document.getElementById("hdnAlertProd").value);
		return true;
	}
}



var xmlHttp

function alertBird(str,strcn)
{ 
	
var url="/alertbird.aspx?txtBirdEmail=" + str + "&txtBirdProduct=" + strcn + "&r=" + new Date().getTime();


xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
} 

function stateChanged() 
{ 
	
if(xmlHttp.readyState == 1){
document.getElementById('txtHint').innerHTML = 'Please Wait.. processing ...';
}
	
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
} 
} 

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null

try{
	
objXmlHttpGet=new XMLHttpRequest();
objXmlHttpGet.onreadystatechange=handler	
	return objXmlHttpGet;
	}

catch (e){
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
} 
}

function echeck(str) 
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1)
		 {
		   
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		   
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1)
		 {
		   
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1)
		 {
		   
		    return false
		 }

 		 return true					
	}


