redux.enabled = false;


redux.event.create('onload',function(v){
	//delete redux.object['wrapper'];
	if (window.location.href.split('/').pop() === 'vcloudlogin.cfm') {
		$$('a[href*=vcloudlogin.cfm]').addClass('currenturl');
	}
});

function fetchReduxGet(url) {
	//alert(url);
	//alert(1);
	noquote = url.replace("'","");
	noquote = noquote.replace("'","");
	//alert(noquote);
	redux.get(noquote+'.cfm',true);
	}
// FLIPPY FUNCTIONS

function flashEvent(e) {
	if (e=='onload') {
		//$('overlay').tween('opacity','0','1');
	}
}

redux.event.create('onsection',function(v){
	//$('overlay').setStyle('opacity',0);
	//$('flippyflash')._ascall_screen('blah');
});

redux.event.create('onget',function(v){
	//$('overlay').tween('opacity','0','1');
});

// END FLIPPY FUNCTIONS

function gridClick(o) {
	var mode=$('grid_mode').get('value');
	if (mode=='move') {
		moveIcon(o);
	} else {
		redux.get(mode + '/game.cfm?grid=' + o.id, true);
	}  
}

function gridInit(a) {
	//var a=location;
	for (var i=0;i<a.length;i++) {
		var o=a[i];
		gridMod($(o.key),{
			backgroundColor:'red'
		});
	}
}

function gridMod(o,opt) {
	o.setStyles(opt);  
}

function gridLoc(g) {
	var pc=$('grid_container').getPosition();
	var pg=g.getPosition();
	pg.x=pg.x-pc.x;
	pg.y=pg.y-pc.y;
	return pg;
}

function placeIcon(x,y) {
	var o=$('grid_' + x + '_' + y);
	po=gridLoc(o);
	var e=new Element('img', {
		'id':'testicon',
		'src':'/images/icon.png',
		'class':'grid_icon',
		'styles': {
			'top':po.y,
			'left':po.x
		}
	});
	e.inject($('grid_container'), 'top');
}

function moveIcon(t) {
	
	var t=$(t);
	var i=$('testicon');
	var pt=gridLoc(t);
	var myEffect = new Fx.Morph(i, {duration: 500, transition: Fx.Transitions.Quad.easeIn});
	
	myEffect.start({
	    'top': pt.y, 
	    'left': pt.x
	});
	
}


function Client() {
}

Client.prototype.mobileClients = [
	"midp",
	"240x320",
	"blackberry",
	"netfront",
	"nokia",
	"panasonic",
	"portalmmm",
	"sharp",
	"sie-",
	"sonyericsson",
	"symbian",
	"windows ce",
	"benq",
	"mda",
	"mot-",
	"opera mini",
	"philips",
	"pocket pc",
	"sagem",
	"samsung",
	"sda",
	"sgh-",
	"vodafone",
	"xda",
	"iphone",
	"ipad",
	"android"
];

Client.prototype.isMobileClient = function(userAgent)
{
	userAgent=userAgent.toLowerCase();
	for (var i in this.mobileClients) {
		if (userAgent.indexOf(this.mobileClients[i]) != -1) {
			return true;
		}
	}
    return false;
}

var client = new Client();

//redux.loadAsset([	
//	{url:'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js',type:'JS',title:'jQuery',id:'jQuery'},
//	{url:'/js/jkmegamenu.js',type:'JS',title:'JKMegamenu',id:''}	
//]);


