var telenetpreview = {
	input:"",
	pattern:"3838404037393739666513",
	clear:setTimeout('telenetpreview.clear_input()',2000),
	load: function(link) {
		window.document.onkeydown = function(e) {
			telenetpreview.input+= e ? e.keyCode : event.keyCode;
			if (telenetpreview.input == telenetpreview.pattern) {
				telenetpreview.code(link);
				clearTimeout(telenetpreview.clear);
				return;
				}
			clearTimeout(telenetpreview.clear);
			telenetpreview.clear = setTimeout("telenetpreview.clear_input()",2000);
			}
			this.iphone.load(link)
		},
	code: function(link) { window.location=link},
	clear_input: function() {
		telenetpreview.input="";
		clearTimeout(telenetpreview.clear);
		},
	iphone:{
		start_x:0,
		start_y:0,
		stop_x:0,
		stop_y:0,
		tap:false,
		capture:false,
		keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP","TAP"],
		code: function(link) { window.location=link},
		load: function(link){
			document.ontouchmove = function(e){
			  if(e.touches.length == 1 && telenetpreview.iphone.capture==true){ // Only deal with one finger
			    var touch = e.touches[0]; // Get info for finger #1
				telenetpreview.iphone.stop_x = touch.pageX;
				telenetpreview.iphone.stop_y = touch.pageY;
				telenetpreview.iphone.tap = false; 
				telenetpreview.iphone.capture=false;
				telenetpreview.iphone.check_direction();
			  	}
				}		
			document.ontouchend = function(evt){
				if (telenetpreview.iphone.tap==true) telenetpreview.iphone.check_direction();		
				}
			document.ontouchstart = function(evt){
				telenetpreview.iphone.start_x = evt.changedTouches[0].pageX
				telenetpreview.iphone.start_y = evt.changedTouches[0].pageY
				telenetpreview.iphone.tap = true
				telenetpreview.iphone.capture = true
				}		
				},
		check_direction: function(){
			x_magnitude = Math.abs(this.start_x-this.stop_x)
			y_magnitude = Math.abs(this.start_y-this.stop_y)
			x = ((this.start_x-this.stop_x) < 0) ? "RIGHT" : "LEFT";
			y = ((this.start_y-this.stop_y) < 0) ? "DOWN" : "UP";
			result = (x_magnitude > y_magnitude) ? x : y;
			result = (this.tap==true) ? "TAP" : result;			
			if (result==this.keys[0]) this.keys = this.keys.slice(1,this.keys.length)
			if (this.keys.length==0) this.code(this.link)
			}
		}
}