// JavaScript Document

function swap(oid, src)
{
	var image = document.getElementById(oid);
	
	if(image)
	{
		image.src = src;
	}
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function changeClass(oid, oclass)
{
	document.getElementById(oid).className = oclass ;
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function projectStripOn(num)
{
		document.getElementById('StripImage'+num).src = 'images/project-strip'+num+'.png';
			
		
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function projectStripOff(num)
{
		document.getElementById('StripImage'+num).src = 'images/small-project-strip'+num+'.png';
		
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function changeImage (id)
{
	var image = document.getElementById('PlusMinus'+id);
	if (image.src.indexOf('images/plus.png') != -1)
	{
		image.src = 'images/minus.png';
	}
	else
	{
		image.src = 'images/plus.png';
	}
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function display(oid, flag)
{
	if(flag == 1)
		document.getElementById(oid).style.display = 'block';
	else 
		if(flag == 0)
			document.getElementById(oid).style.display = 'none';
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function popUp()
{
	win3 = window.open("","Web Developer","menubar=1,resizable=1,width=450,height=400"); 
	win3.document.writeln("<div id=\"BackgroundImg\"><img src=\"images/body-bg.jpg\"></div>"
						+	"<div id=\"VacancyDetails\">"
						+		"<div class=\"VacancyTitle\">Web Developer</div>"
   						+			"<ul class=\"VacancyDetailed\">"
   						+ 				"<li>"
      					+					"<div class=\"VacancySubTitle\">Description</div>"
      					+ 					"<div id=\"VacancyDesc\"> SETS has expert capabilities to provide specialist services in Strategic Transport Planning, Transport Policies and Systems, Transport Infrastructure Development, and Traffic Engineering, Management and Control, in addition to planning, engineering, construction, operation, and management services to the public and private transport industries.</div>"
        				+				"</li>"
        				+ 				"<li>"
     					+  					 "<div class=\"VacancySubTitl\">Requirements</div>"
     					+   				 "<div id=\"VacancyDesc\"> SETS has expert capabilities to provide specialist services in Strategic Transport Planning, Transport Policies and Systems, Transport Infrastructure Development, and Traffic Engineering, Management and Control, in addition to planning, engineering, construction, operation, and management services to the public and private transport industries.</div>"
      					+				"</li>"
       					+			"</ul>"
						+	 "</div>");
	
}

/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function showImage(src,current,total,id)
{
	var count = document.getElementById('count').value;
	var page = document.getElementById('page').value;
	var album = document.getElementById('album_id').value;
	if(current==(total-1))
	{
		if(count>((page*8)+8))
		{
			page = parseInt(page)+1;
			document.getElementById('Next').innerHTML='<a  id="nextLink" onClick="javascript:xajax_loadPage('+page+','+album+');" onMouseOver="javascript:swap(\'NextArrow\',\'images/next-arrow-on.png\');" onMouseOut="javascript:swap(\'NextArrow\',\'images/next-arrow.png\');" >Next</a><img src="images/next-arrow-on.png" width="4" height="8" id="NextArrow"></div>';
		}
		else
			document.getElementById('Next').innerHTML='<a  id="nextLink" href="javascript:;"  class="Off" onClick="javascript:return false;">Next</a><img src="images/next-arrow-on.png" width="4" height="8" id="NextArrow"></div>';
	}
	else
	{
		   document.getElementById('Next').innerHTML='<a id="nextLink" onClick="nextImage()"  onMouseOver="javascript:swap(\'NextArrow\',\'images/next-arrow-on.png\');" onMouseOut="javascript:swap(\'NextArrow\',\'images/next-arrow.png\');">Next</a><img src="images/next-arrow.png" width="4" height="8" id="NextArrow">';
	}

	if(document.getElementById('imgid').value==0)
	{
		document.getElementById('Prev').innerHTML='<img src="images/prev-arrow.png" width="4" height="8" id="PrevArrow"><a onClick="prevImage()" onMouseOver="javascript:swap(\'PrevArrow\',\'images/prev-arrow-on.png\');" onMouseOut="javascript:swap(\'PrevArrow\',\'images/prev-arrow.png\');">Previous</a>';
	}
	else if(current==0)
	{
		if(page>0)
		{
			page = parseInt(page)-1;
			document.getElementById('Prev').innerHTML='<img src="images/prev-arrow.png" width="4" height="8" id="PrevArrow"><a onClick="javascript:xajax_loadPageBack('+page+','+album+');" onMouseOver="javascript:swap(\'PrevArrow\',\'images/prev-arrow-on.png\');" onMouseOut="javascript:swap(\'PrevArrow\',\'images/prev-arrow.png\');">Previous</a>';
		}
		else
		   document.getElementById('Prev').innerHTML='<img src="images/prev-arrow-on.png" width="4" height="8" id="PrevArrow"><a href="javascript:;"  class="Off" onClick="javascript:return false;">Previous</a>';
	}
	
	document.getElementById('imgid').value=current;
	var img = document.getElementById('big-img');
	img.src = src;
	
	for(i=0;i<total;i++)
	{
		var img_a = document.getElementById('h'+i);
		if(i == current)
		{
			img_a.style.cursor='default';
			document.getElementById('RollOver'+current).style.display = 'block';
			img_a.onmouseover=function(){};
			img_a.onmouseout=function(){};
		}
		else
		{
			document.getElementById('RollOver'+i).style.display = 'none';
			img_a.style.cursor='pointer';
			img_a.onmouseover = showRollOver(i) ;
			img_a.onmouseout = hideRollOver(i) ;
		}
	}
}

/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function showRollOver(i)
{
	return function() { document.getElementById('RollOver'+i).style.display = 'block'; };
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function hideRollOver(i)
{
	return function() { document.getElementById('RollOver'+i).style.display = 'none'; };
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function nextImage()
{
	
	var imgid = 0;
	if(document.getElementById('imgid').value!=null)
	{
		if(document.getElementById('total').value!=document.getElementById('imgid').value)
			imgid = (parseInt(document.getElementById('imgid').value) + 1);
	}
	var index = 'h'+imgid;
	
	eval(document.getElementById(index).getAttribute('href').substr(11));
	//count = document.getElementById('count').value;
}

function prevImage()
{
	var imgid = 0;
	if(document.getElementById('imgid').value!=null)
	{
		if(document.getElementById('imgid').value!=0)
			imgid = (parseInt(document.getElementById('imgid').value) - 1);
	}
	var index = 'h'+imgid;	
	eval(document.getElementById(index).getAttribute('href').substr(11));
}

/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function nextProjectImage()
{
	
	var imgid = 0;
	if(document.getElementById('imgid').value!=null)
	{
		
		if(document.getElementById('total').value!=document.getElementById('imgid').value)
			imgid = (parseInt(document.getElementById('imgid').value) + 1);
	}
	var index = 'h'+imgid;
	
	eval(document.getElementById(index).value);
	
}

function prevProjectImage()
{
	var imgid = 0;
	if(document.getElementById('imgid').value!=null)
	{
		if(document.getElementById('imgid').value!=0)
			imgid = (parseInt(document.getElementById('imgid').value) - 1);
	}
	var index = 'h'+imgid;	
	eval(document.getElementById(index).value);
}

function showProjectImage(src,current,total,id)
{

	if(current==(total-1))
	{
		document.getElementById('Next').innerHTML='<a id="nextLink" href="javascript:;"  class="Off" onClick="javascript:return false;">Next</a><img src="images/next-arrow-on.png" width="4" height="8" id="NextArrow"></div>';
	}
	else
	{
		   document.getElementById('Next').innerHTML='<a id="nextLink" onClick="nextProjectImage()"  onMouseOver="javascript:swap(\'NextArrow\',\'images/next-arrow-on.png\');" onMouseOut="javascript:swap(\'NextArrow\',\'images/next-arrow.png\');">Next</a><img src="images/next-arrow.png" width="4" height="8" id="NextArrow">';
	}

	if(document.getElementById('imgid').value==0)
	{
		document.getElementById('Prev').innerHTML='<img src="images/prev-arrow.png" width="4" height="8" id="PrevArrow"><a onClick="prevProjectImage()" onMouseOver="javascript:swap(\'PrevArrow\',\'images/prev-arrow-on.png\');" onMouseOut="javascript:swap(\'PrevArrow\',\'images/prev-arrow.png\');">Previous</a>';
	}
	else if(current==0)
	{
	   document.getElementById('Prev').innerHTML='<img src="images/prev-arrow-on.png" width="4" height="8" id="PrevArrow"><a href="javascript:;"  class="Off" onClick="javascript:return false;">Previous</a>';
	}
	
	document.getElementById('imgid').value=current;
	var img = document.getElementById('big-img');
	img.src = src;
}


