var t;
var changedImg = 0;

function point_it(e) {
	var posx = 0;
	var posy = 0;
	
	if (!e) {
		var e = window.event;
	}
	
	if (e.pageX || e.pageY) {
		posx = e.pageX;
		posy = e.pageY;
	} else if (e.clientX || e.clientY) {
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}

	var pos = 0;	
	pos = findPos(document.getElementById('pointer_div'));
	
	posx = posx - pos[0];

	var totalWidth = 295;
	var myPercent = (posx * 100) / totalWidth;

	movObj = document.getElementById('movie1');
	var movDuration = movObj.GetDuration();
	var myTime = (movDuration / 100) * myPercent;

	movObj.SetTime(myTime);
}

function findPos(obj) {
	var curleft = curtop = 0;
	
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	
	return [curleft,curtop];
}

function sPop(Vfile,W,H) {
	window.open("https://secure.mobilitypass.com/" + Vfile ,'_blank','scrollbars=no,status=no,width=' + W + ',height=' + H);
}

function movieToggle(ObjId) {
	movObj = document.getElementById(ObjId);
	if (movObj.GetRate() == 0) {
		movObj.Play();
		document.images['img_play'].src = "images/C_pause.gif";
	} else {
		movObj.Stop();
		document.images['img_play'].src = "images/C_play.gif";
	}
}

function waitForMovie() {
		var r = setTimeout("takeCareOfMovie('movie1');",2000);
}

function takeCareOfMovie(ObjId) {
	movObj = document.getElementById(ObjId);
	var movDuration = movObj.GetDuration();
	var curPosition = movObj.GetTime();
	var myPercent = (curPosition * 100) / movDuration;
	
	var myTableWidth = "285";
	var myPadding = (myTableWidth / 100) * myPercent;

	document.getElementById('img_arrow').style.marginLeft = myPadding;

	updateBufferBar('movie1');

	var t = setTimeout("takeCareOfMovie('movie1');",1000);
	
}

function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; 
  
  for(i = 0; a && i < a.length &&( x = a[i]) && x.oSrc; i++) {
  	
  	if (x.name == "img" + changedImg) {
  		// pass
  	} else {
  		x.src=x.oSrc;
  	}
  }
}


function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)	
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}


function MM_swapImage() {

  var i,j=0,x,a=MM_swapImage.arguments; 
  
  if (a[3] == changedImg) {
  	return false;
  }
 
  document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// functions for loading bar
function updateBufferBar(ObjId) {
	movObj = document.getElementById(ObjId);
	
	var myDuration = movObj.GetMovieSize();
	var myLoadedTime = movObj.GetMaxBytesLoaded();
	var myPercent = (myLoadedTime * 100) / myDuration;
	
	if (myLoadedTime > 20) {
		document.images['img_left'].src = "images/S_left_on.gif";
	}
	
	var myTableWidth = "289";
	var myPadding = (myTableWidth / 100) * myPercent;

	document.images['img_buffer'].width = myPadding;
	
	if (myLoadedTime > (myDuration - 20)) {
		document.images['img_right'].src = "images/S_right_on.gif";
	}

}

// functions for services
function toggleService(serviceNum) {
	var i = 1;
	
	for(i = 1; i < 10; i++) {
		if(i == serviceNum) {
			myImgName = 'img' + i;
			document.images[myImgName].src = "images/manu_" + i + "_b.gif";
			changedImg = i;
		} else {
			myImgName = 'img' + i;
			document.images[myImgName].src = "images/manu_" + i + "_a.gif";
		}
	}

	showService(serviceNum);
}

// functions for services
function requestService(serviceNum) {
	AR = new MPHR();
	AR.resTarget = 'MycontentLayer'; 
	contenturl = '/features.html?id=' + serviceNum;
	AR.GET(contenturl); 
}

function showService(serviceNum) {
	var t = 0;
	
	for(t = 0; t < 10; t++) {
		if(t == serviceNum) {
			myServiceName = 'service' + t;
			myServiceTextName = 'service' + t + "text";
			servObj = document.getElementById(myServiceName);
			servObj.style.visibility = "visible";
			txtObj = document.getElementById(myServiceTextName);
			txtObj.style.visibility = "visible";
		} else {
			myServiceName = 'service' + t;
			myServiceTextName = 'service' + t + "text";
			servObj = document.getElementById(myServiceName);
			servObj.style.visibility = "hidden";
			txtObj = document.getElementById(myServiceTextName);
			txtObj.style.visibility = "hidden";
		}
	}
}



function miniAx()
	{
		this.w2w = function(w,s) {  document.getElementById(w).innerHTML = s; }
		this.c2c = function(w) { return document.getElementById(w).innerHTML; }
		this.gobj = function(w) { return document.getElementById(w); }
	}	
		
function p2t() { 
this.pa = ""; 
this.p2t = function(d,t) { for(var i in d) { if(!this.ia(d[i])  && !this.io(d[i])) {   s = '@@' + i + '@@'; sp = 0; sp = t.indexOf(s); bp = 0; while( sp > -1) { t = t.substring(0,sp) + d[i] + t.substring((sp+s.length)); bp = sp+s.length; sp = t.indexOf(s,bp); } } else { t = this.p2t_l2(d[i],t,i);  this.pa = ""; }  } return t; }  
this.p2t_l2 = function(d,t,p) { if(p) { this.pa = this.pa + p + ":"; } for(var i in d) { if(!this.ia(d[i]) && !this.io(d[i]) ) { s = '@@' + this.pa + i + '@@'; sp = 0; sp = t.indexOf(s); bp = 0; while( sp > -1) { t = t.substring(0,sp) + d[i] + t.substring((sp+s.length)); bp = sp+s.length; sp = t.indexOf(s,bp); } } else { t = this.p2t_l2(d[i],t,i); Vna = this.pa.split(":"); Vna.pop(); Vna.pop(); this.pa = Vna.join(":")  + ':' ; } } return t; } 
this.ia = function(v) { return (v instanceof Array); } 
this.io = function(v) { if(this.ia(v)) { return false; } else { return (v !== null) && (typeof(v) == 'object'); }}
}

CtypeIsclosed = true;
function ShowCtype()
	{
		if(CtypeIsclosed) {
		Vctype = "%3Cdiv%20class%3D%22connectiondesc%22%3E%0A%3Ch3%3EAll%20Cities%3C%2Fh3%3E%0A%3Cp%3EThe%20%22All%20Cities%20%22%20means%20that%20a%20local%20phone%20charge%20will%20be%20applied%20by%20the%20phone%20operator%20or%20the%20hotel%20from%20any%20location%20in%20the%20country.%3C%2Fp%3E%0A%3Ch3%3EDialup%3C%2Fh3%3E%0A%3Cp%3EThe%20%22Local%20In%20City%22%20is%20a%20number%20inside%20the%20city%20itself.%20The%20phone%20charge%20applied%20by%20your%20local%20operator%20or%20the%20hotel%20will%20be%20the%20same%20as%20a%20call%20to%20this%20city.%3C%2Fp%3E%0A%3Ch3%3ETollfree%3C%2Fh3%3E%0A%3Cp%3EThe%20%22TollFree%22%20means%20that%20no%20phone%20charges%20will%20be%20applied%20by%20the%20phone%20operator%20or%20the%20hotel.%20The%20phone%20call%20is%20free%20%28as%20800%20numbers%20in%20US%20and%20Canada%29.%3C%2Fp%3E%0A%3Ch3%3EWifi%3C%2Fh3%3E%0A%3Cp%3EThe%20%22Wifi%22%20means%20that%20you%20can%20connect%20to%20the%20Internet%20through%20a%20wireless%20connection%20using%20a%20High%20Speed%20access.%20You%20need%20to%20be%20at%20the%20exact%20location%20of%20the%20Hotspot.%3C%2Fp%3E%0A%3Ch3%3EBroadband%3C%2Fh3%3E%0A%3Cp%3EThe%20%22Broadband%22%20means%20that%20you%20can%20connect%20to%20the%20Internet%20through%20a%20wired%20connection%20using%20a%20High%20Speed%20access.%20You%20need%20to%20be%20at%20the%20exact%20location%20of%20the%20connection.%3C%2Fp%3E%0A%3Ch3%3E3G%3C%2Fh3%3E%0A%3Cp%3EMobile%20Broadband.%20You%20can%20connect%20to%20the%20Internet%20everywhere%20using%20a%20wireless%20high%20speed%203G%20%2F%20UMTS%20%2F%20GPRS%20%2F%20HSPDA%20%2F%20EDGE%20access%20without%20the%20need%20of%20being%20on%20a%20precise%20location.%3C%2Fp%3E%0A%3C%2Fdiv%3E";
		MX = new miniAx;
		MX.w2w('disctype',unescape(Vctype));
		CtypeIsclosed = false;
		} else {
			CtypeIsclosed = true;
			CloseCtype();
		}
	}
function CloseCtype()
	{
		MX = new miniAx;
		MX.w2w('disctype','');

	}	