/* Copyright 2003 - 2005 Unify Media Ltd */


/*
// Fails on ECMA browsers - workes in IE
if (document.body){
	document.body.onresize = function (){
		location.reload();
	}
}
*/

/* Global Popup Window */
function RevPop(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+''
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

/* Global Ajax Class */
/*
Note: Only uses plain text, not XML object;
Usage:

function testme (what){
	alert(data);
}
dowhater = new revAjax('data.txt');
dowhater.send('test=1&yes=no', 'testme');

*/
function revAjax (url){
	this.url = url;
	this.trigger = 'test';

	this.ghr = function () {
	  if ( typeof ActiveXObject!="undefined" ) {
		try { return new ActiveXObject("Microsoft.XMLHTTP") }
		catch(a) { }
	  }
	  if ( typeof XMLHttpRequest!="undefined" ) {
		return new XMLHttpRequest();
	  }
	  return null;
	}

	this.send = function(query,func) {
	  var r = this.req;
	  r.open("POST", this.url ,true);
	  r.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

	  r.onreadystatechange= function (){ 
         if ( r.readyState == 4 ) {
             if( r.status == 200 ) {
				var data = r.responseText;
				eval(func+'(data)');
			 }
		 }
	  }

	  this.req.send( query );
	}

	this.req	= this.ghr();
}

// Wojtek's Flag Function 
function Flags(){
	this._cntry={EC:0,CY:1,DO:2,CZ:3,EE:4,EG:5,EH:6,DZ:7,ER:8,ES:9,FI:10,ET:11,FJ:12,EU:13,FK:14,GA:15,FM:16,GB:17,FO:18,GD:19,GE:20,GF:21,FR:22,GH:23,GI:24,GL:25,GM:26,GN:27,GP:28,GQ:29,GR:30,GS:31,GT:32,GU:33,HK:34,GW:35,HM:36,HN:37,GY:38,ID:39,IE:40,HR:41,HT:42,HU:43,IL:44,IN:45,IO:46,IQ:47,IR:48,IS:49,IT:50,JM:51,JO:52,KE:53,JP:54,KG:55,KH:56,KI:57,LA:58,KM:59,LB:60,KN:61,LC:62,KP:63,KR:64,LI:65,LK:66,MA:67,KW:68,MC:69,KY:70,MD:71,KZ:72,ME:73,MG:74,LR:75,MH:76,LS:77,LT:78,LU:79,MK:80,LV:81,ML:82,NA:83,MM:84,MN:85,NC:86,LY:87,MO:88,NE:89,MP:90,NF:91,MQ:92,NG:93,MR:94,MS:95,NI:96,MT:97,MU:98,MV:99,NL:100,MW:101,MX:102,MY:103,NO:104,MZ:105,NP:106,NR:107,NU:108,PA:109,OM:110,NZ:111,PE:112,PF:113,PG:114,PH:115,PK:116,PL:117,QA:118,PM:119,PN:120,PR:121,PS:122,PT:123,PW:124,PY:125,RE:126,SA:127,SB:128,SC:129,RO:130,SD:131,SE:132,SG:133,SH:134,RS:135,SI:136,SJ:137,RU:138,SK:139,SL:140,RW:141,SM:142,SN:143,TC:144,SO:145,TD:146,TF:147,TG:148,SR:149,TH:150,ST:151,TJ:152,TK:153,SV:154,TL:155,UA:156,TM:157,TN:158,SY:159,TO:160,SZ:161,UG:162,TR:163,TT:164,TV:165,VA:166,TW:167,UM:168,VC:169,TZ:170,VE:171,VG:172,US:173,VI:174,VN:175,UY:176,UZ:177,WF:178,VU:179,WS:180,YE:181,ZA:182,YT:183,ZM:184,ZW:185,AD:186,AE:187,AF:188,AG:189,AI:190,AL:191,BA:192,AM:193,BB:194,AN:195,AO:196,BD:197,BE:198,BF:199,BG:200,AR:201,BH:202,AS:203,BI:204,AT:205,BJ:206,AU:207,CA:208,AW:209,BM:210,AX:211,BN:212,CC:213,BO:214,CD:215,AZ:216,CF:217,CG:218,BR:219,CH:220,BS:221,CI:222,BT:223,CK:224,BV:225,CL:226,BW:227,CM:228,CN:229,BY:230,CO:231,BZ:232,DE:233,CR:234,CS:235,DJ:236,CU:237,DK:238,CV:239,DM:240,CX:241};
};Flags.prototype={
	g:function(a){
		return this._cntry[a];
	},sO:function(o,a){
		var i=this.g(a),y=-i*17;
		if(i<0)return;
		if(y>2000)y-=4114;
		o.style.background='transparent url("/images/flags.png") 0px '+y+'px no-repeat';
	},pSv:function(o){
		if(typeof(o)=='string')o=document.getElementById(o);
		if(!o||!o.childNodes)return;
		var t,i,c=o.childNodes;
		for(i=0;i<c.length;i++){
			var t2,i2,c2=c[i].childNodes;
			for(i2=0;i2<c2.length;i2++){
				t2=c2[i];
				alert(t2.value);
				if(t2.value.length==2)
					this.sO(t2,t2.value);
			}
		}
	}
};
var flags=new Flags();
//flags.pSv('name of drop down')

// On Body Loader we loop through an array 
var windowOnload = new Array();
window.onload = function (){
	for (i=0; i<windowOnload.length ;i++ ){
		eval( windowOnload[i] );
	}
}

windowOnload.push('tester();');

function tester (){
//	alert(1);
	//document.className = 'yui-skin-sam';
}


//function setToolTips(){
//
//	var as = document.getElementById('globalNav5').getElementsByTagName('A');
//	for (var i=0;i<as.length;i++){
//		
//		var elem = as[i];
//		var name = 'ttgn5' + i;
//		var tt = new YAHOO.widget.Tooltip(name, { context: elem });
//	}
//}
//
//// Instantiate and configure Loader:
//var loader = new YAHOO.util.YUILoader({
//
//    // Identify the components you want to load.  Loader will automatically identify
//    // any additional dependencies required for the specified components.
//    require: ["container"],
//
//    // Configure loader to pull in optional dependencies.  For example, animation
//    // is an optional dependency for slider.
//    loadOptional: true,
//	defaultSkin: 'sam',
//
//    // The function to call when all script/css resources have been loaded
//    onSuccess: function() {
//        //this is your callback function; you can use
//        //this space to call all of your instantiation
//        //logic for the components you just loaded.
//		//setToolTips();
//    }
//});
//
//// Load the files using the insert() method. The insert method takes an optional
//// configuration object, and in this case we have configured everything in
//// the constructor, so we don't need to pass anything to insert().
//loader.insert();

