/* Copyright All World Jobs Ltd 2009. All Rights Reserved */

var xmlhttp=false;

function getxmlhttp()
{
	var _xmlhttp=false;

	try 
	{
  		_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) 
 	{
  		try 
  		{
   		_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  		} catch (E) 
  		{
   		_xmlhttp = false;
  		}
 	}
	if(!_xmlhttp && typeof XMLHttpRequest!='undefined') 
	{
  		_xmlhttp = new XMLHttpRequest();
	}
	return _xmlhttp;
}




function setimgloaded(img)
{
	imgscomplete=1;
}

	
function xin() 
{
	imgs = d.getElementById("photobox").getElementsByTagName("img");
	imgs[1].xOpacity = 0;
	imgs[0].style.display = "block";
	imgs[0].xOpacity = .99;
	setTimeout(xf,4000);
}

function xf() 
{
	if((!ci(imgs[0]))||(!ci(imgs[1]))||(imgscomplete==0)) 
	{
		setTimeout(xf,50);
		return;
	}

	cOpacity = imgs[current].xOpacity;
	nIndex = 1 - current;
	nOpacity = imgs[nIndex].xOpacity;
	
	cOpacity-=.05; 
	nOpacity+=.05;
	
	imgs[nIndex].style.display = "block";
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	
	so(imgs[current]); 
	so(imgs[nIndex]);
	
	if(cOpacity<=0) 
	{		
		imgs[current].style.display = "none";
		imgscomplete = 0;
		imgs[current].src = files[nextimg];
		
	
		nextimg++;
		if(nextimg>=files.length) nextimg=0;
		current = nIndex;
		setTimeout(xf,4000);
	} else setTimeout(xf,50);

	function so(obj) 
	{
		if(obj.xOpacity>.99) 
		{
			obj.xOpacity=.99; 
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
	
	function ci(img)
	{
    if (!img.complete) return false;
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) return false;
    return true;
	}
}

function getElementLeft(elem) 
{

	
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) 
  		{
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;
}


function getElementTop(elem) 
{
	yPos = elem.offsetTop;
	tempEl = elem.offsetParent;
	while (tempEl != null) 
	{
  		yPos += tempEl.offsetTop;
	 		tempEl = tempEl.offsetParent;
  }
	return yPos;
}