
var Geo = Class.create();

Geo.prototype = {
	initialize: function() {
	
	        this.continent_code = 'NA';	
	        this.country_code = 'US';	
	        this.country_code3 = 'USA';	
	        this.country_name = 'United States';	
	        this.region = '';	
	        this.city = '';	
	        this.postal_code = '';	
	        this.latitude = '38';	
	        this.longitude = '-97';	
	        this.dma_code = '0';	
	        this.area_code = '0';	
	        this.east = '-7719030';	
	        this.north = '6510996';	
		
		this.timer = null;
	},
    processRedirect: function(conditions,url) {
    	this.url = url;
    	var self = this;
    	for(i=0;i<conditions.length;i++) {
    		var val = eval('this.'+conditions[i].name);
    		if(val == conditions[i].value) {
    			$('redirector').update(new Element('a', { href: 'javascript:void(0);', onclick: 'gl.cancel()', class: 'cancel' }).update('Cancel'));
    			$('redirector').insert(new Element('img', { style: 'float: left; margin-right: 6px;', src: '/images/flags/'+this.country_code.toLowerCase()+'.png' }));
    			$('redirector').insert('You are being redirected to ');
    			$('redirector').insert(new Element('a', { href: url }).update(url.truncate(42, '...')));	
    			
    			$('redirector').setStyle({
				display: 'block',
			});

    			this.timer = setTimeout ( function() {
					clearTimeout(self.timer);
					window.location = url;
				}, 5000 );    			
    			i = 99999;
    		}
    	}
    },
    cancel: function() {
    	var self = this;
    	clearTimeout(self.timer);
    	Effect.Fade('redirector');
    }
};


