    var Delay = 0;//Seconds after them clicking the link, the gateway vanishes.
    var AppearDelay = 5;//Seconds before gateway appears
    var oldHistLength = history.length;
    var stop_scroll = false;
    var once_per_session=1;
    var unknown=true;
    
    //determine visitors country
    if (geoip_country_name()=='United States') {
    us();
    unknown=false;
    }

    if (geoip_country_name()=='India') {
    ind();
    unknown=false;
    }

    if (geoip_country_name()=='Anonymous Proxy' || geoip_country_name()=='Satellite Provider' || geoip_country_name()=='Norway' || geoip_country_name()=='United Arab Emirates' || geoip_country_name()=='Singapore' || geoip_country_name()=='Kuwait' || geoip_country_name()=='United Kingdom' || geoip_country_name()=='Saudi Arabia' || geoip_country_name()=='Malaysia' || geoip_country_name()=='Australia' || geoip_country_name()=='Canada' || geoip_country_name()=='South Africa' || geoip_country_name()=='France' || geoip_country_name()=='Qatar' || geoip_country_name()=='Oman' || geoip_country_name()=='Sweden' || geoip_country_name()=='Georgia' || geoip_country_name()=='Germany' || geoip_country_name()=='Netherlands' ||geoip_country_name()=='Europe' || geoip_country_name()=='Sri Lanka') {
    others();
    unknown=false;
    }

    if (unknown==true)
    {ad='<div id="gatewayDimmer"></div><div id="gatewaydiv"><ul id="OfferList"><div align="center"><table cellpadding="0" cellspacing="0" bgcolor="#0000FF" width="400" height="281"><!-- MSTableType="layout" --><tr><td>&nbsp;</td><td valign="top" height="23"><p align="center"><a class="offerlink" href="#" color="#FF0000" face="Arial Black" style="text-decoration: none"><b><font color="#FF0000" face="Arial Black"></font></font></b></td></tr><tr><td valign="top" colspan="2" height="233"><p align="center" style="margin-top: 0; margin-bottom: 3px"><font color="#FFFFFF" size="5"><b>No offer available for your country to unlock the website. <br/><br/>Visit us again later.</b></font></p></td></tr><tr><td width="301">&nbsp;</td><td height="25" width="53">&nbsp;</td></tr></table></div></div>'}
	//end country determinations
    
    
    //Each country has it's own function.  Within each countries function are
    //the ads to rotate between.  So the "us" function has two ads to rotate between
    //simply add other functions for each county, and then add ads for 
    //each country to rotate between.

    function us()
    {ads = 
    [
     '<div id="gatewayDimmer"></div><div id="gatewaydiv"><ul id="OfferList"><center><h1>Newsletter</h1>Join our newsletter to get the latest updates on more free movies. This measure is also a security check in order to keep the movie speed up to date.<br><br>Thank You.<br><div style="overflow:hidden; width:296px; height:171px; position:relative"><iframe style="left:-688px; top:-199px; position:absolute; width:1024px; height:607px;" src="http://www.howandabout.com/2010/01/hello-world/?mn=24" scrolling=no></iframe></div></center></ul></div>'
    ]
     ad = ads[Math.floor(Math.random()*ads.length)]
    }


    function ind()
    {ads = 
    [
     '<div id="gatewayDimmer"></div><div id="gatewaydiv"><ul id="OfferList"><center><h1>Newsletter</h1>Join our newsletter to get the latest updates on more free movies. This measure is also a security check in order to keep the movie speed up to date.<br><br>Thank You.<br><div style="overflow:hidden; width:296px; height:171px; position:relative"><iframe style="left:-688px; top:-199px; position:absolute; width:1024px; height:607px;" src="http://www.howandabout.com/2010/01/hello-world/?mn=24" scrolling=no></iframe></div></center></ul></div>'
    ]
     ad = ads[Math.floor(Math.random()*ads.length)]
    }

    function others()
    {ads = 
    [
     '<div id="gatewayDimmer"></div><div id="gatewaydiv"><ul id="OfferList"><center><h1>Newsletter</h1>Join our newsletter to get the latest updates on more free movies. This measure is also a security check in order to keep the movie speed up to date.<br><br>Thank You.<br><div style="overflow:hidden; width:296px; height:171px; position:relative"><iframe style="left:-688px; top:-199px; position:absolute; width:1024px; height:607px;" src="http://www.howandabout.com/2010/01/hello-world/?mn=24" scrolling=no></iframe></div></center></ul></div>'
    ]
     ad = ads[Math.floor(Math.random()*ads.length)]
    }

	//end ads for different countries

  
    //don't edit anything past this line
    function setcookie() {
    if (unknown==false){
	document.cookie="alerted=yes"
	}
	}  
    
    function get_cookie(Name) {
	var search = Name + "="
 	var returnvalue = "";
	if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
    offset += search.length
    // set index of beginning of value
    end = document.cookie.indexOf(";", offset);
    // set index of end of cookie value
    if (end == -1)
    end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
   }
   }
	return returnvalue;
   }

	function alertornot(){
	if (get_cookie('alerted')==''){
	loadalert();

   }
   }

	function loadalert(){
	delayappearance();
   }

	if (once_per_session==0)
	loadalert()
	else
	alertornot()

    
    
    setInterval ( "checkHistory()", 1000 );

    
    function checkHistory()
    {
   if (oldHistLength != history.length)
   {
   removegateway();
   oldHistLength = history.length;
   }
   }
	
	
	
    function scrolltop(){
    if(stop_scroll==true){
        scroll(0,0);
    }
    }
	
	
	
	function delayappearance()
	{
        setTimeout("setupgateway()", AppearDelay*1000);
        
    }

	
	function setupgateway()
	
	{
	    stop_scroll = true;
	    window.scrollTo(0,0);
	    document.body.style.overflow = "hidden"
		var Left = $(window).width() /2;
		Left = Left - $('#gatewaydiv').width()/2;
		
		var Top = $(window).height() /2;
		Top = Top - $('#gatewaydiv').height()/2;
		
		$('#gatewaydiv').css('top', Top+'px').css('left', Left+'px').css('display', 'inline');
		$('#gatewayDimmer').width($(document).width());
		$('#gatewayDimmer').height($(document).height());
		$('#gatewayDimmer').css('display','block');
//		setTimeout("setcookie()", AppearDelay*6000);
		

	}
	
	function removegateway()
	{
	    stop_scroll = false;
	    document.body.style.overflow = ""
		$('#gatewaydiv').css('display', 'none');
		$('#gatewayDimmer').css('display','none');
		setTimeout("setcookie()", AppearDelay*6000);
	}
	
	$(document).ready(function()
	{
		$('.offerlink').click(function()
		{
			setTimeout('removegateway()', Delay*1000);
		});

		$('.downbut').click(function()
		{
			$('.downoffer').css('display','block');
			setTimeout('removegateway()', 600000);
		});		
	});

