function startTime()
{
	var days=new Array(8);
	days[0]="Sunday";
	days[1]="Monday";
	days[2]="Tuesday";
	days[3]="Wednesday";
	days[4]="Thursday";
	days[5]="Friday";
	days[6]="Saturday";
	var months = new Array(13);
   months[0]  = "January";
   months[1]  = "February";
   months[2]  = "March";
   months[3]  = "April";
   months[4]  = "May";
   months[5]  = "June";
   months[6]  = "July";
   months[7]  = "August";
   months[8]  = "September";
   months[9]  = "October";
   months[10] = "November";
   months[11] = "December";
   var today=new Date();

   var monthnumber = today.getMonth();
   var monthname   = months[monthnumber];
   var monthdate    = today.getDate();
   var daynumber =today.getDay();
   var dayname = days[daynumber];
   var mnth=today.getMonth();
   var hour=today.getHours();
   var minute =today.getMinutes();
   var second =today.getSeconds();
   t=setTimeout('startTime()',500);
   var ap = "AM";
   if (hour   > 11) { ap = "PM";             }
   if (hour   > 12) { hour = hour - 12;      }
   if (hour   == 0) { hour = 12;             }
   if (hour   < 10) { hour   = "0" + hour;   }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString = hour +
                    ':' +
                    minute +
                    ':' +
                    second +
                    " " +
                    ap;
  document.getElementById('photoTime').value=hour+":"+minute+":"+second+" "+ap;
  document.getElementById('videoTime').value=hour+":"+minute+":"+second+" "+ap;
  document.getElementById('soundTime').value=hour+":"+minute+":"+second+" "+ap;
  document.getElementById('scriptTime').value=hour+":"+minute+":"+second+" "+ap;

}
/*---------------------------------------------------------------------------------------------------------*/
Event.observe(window, 'load', function() { 
		var imgload = 'gfx/arrowsover.gif';
		var arrowsover = new Image();
});
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=600,height=400,scrollbars=yes');
return false;
}
/*---------------------------------------------------------------------------------------------------------*/
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
function submituniv(str)
{
	//alert (str);
	destination="forumCategory.php?limit="+str;
	window.location.href=destination; 
	
}
function municipalSearchSubmit(val1,val2)
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(val2 == "")
	{
	alert("Please choose a Municipality!");
	}
	if(sPage == 'municipalForum.php')
	{
	window.location.href="?provcode="+val1+"&municcode="+val2;
	}
	if(val2 != "")
	{
		if(sPage == 'chooseMunic.php')
		{
			window.location.href="municforumCategory.php?provcode="+val1+"&municcode="+val2;
		}
	}

}
function forumpost(form1)
{
	var title=document.form1.title.value;
	if(ltrim(title)=="")
	{
		alert("Please enter title.");
		document.form1.title.value=""
		document.form1.title.focus();
		return false;
	}
	var description=document.form1.description.value;
	if(ltrim(description)=="")
	{
		alert("Please enter description.");
		document.form1.description.value=""
		document.form1.description.focus();
		return false;
	}
	if(document.form1.choosesound.value != "")
	{
		if(document.form1.txtSoundloc.value == "")
		{
			alert("Please enter location of recording");
			document.form1.txtSoundloc.value=""
			document.form1.txtSoundloc.focus();
			return false;
		}
		if(document.form1.soundTime.value == "")
		{
			alert("Please enter Date of recording(mm/dd/yyyy)");
			document.form1.soundTime.value=""
			document.form1.soundTime.focus();
			return false;
		}
		if(document.form1.audioHr.selectedIndex=="0")
		{
			alert("Please enter Time of recording(hh, 0-24)");
			document.form1.audioHr.focus();
			return false;
		}
	}
	if(document.form1.choosevideo.value != "")
	{
		if(document.form1.txtVideoloc.value == "")
		{
			alert("Please enter location of recording");
			document.form1.txtVideoloc.value=""
			document.form1.txtVideoloc.focus();
			return false;
		}
		if(document.form1.videoTime.value == "")
		{
			alert("Please enter Date of recording(mm/dd/yyyy)");
			document.form1.videoTime.value=""
			document.form1.videoTime.focus();
			return false;
		}
		if(document.form1.videoHr.selectedIndex=="0")
		{
			alert("Please enter Time of recording(hh, 0-24)");
			document.form1.videoHr.focus();
			return false;
		}
	}
	if(document.form1.choosephoto.value != "")
	{
		if(document.form1.txtPhotoloc.value == "")
		{
			alert("Please enter location of recording");
			document.form1.txtPhotoloc.value=""
			document.form1.txtPhotoloc.focus();
			return false;
		}
		if(document.form1.photoTime.value == "")
		{
			alert("Please enter Date of recording(mm/dd/yyyy)");
			document.form1.photoTime.value=""
			document.form1.photoTime.focus();
			return false;
		}
		if(document.form1.photoHr.selectedIndex=="0")
		{
			alert("Please enter Time of recording(hh, 0-24)");
			document.form1.photoHr.focus();
			return false;
		}
	}
return true
}
function showLabels(val,str)
{
	if($(val).checked ==false)
	{
		$(str+'1').show();
		$(str+'2').show();
		$('lblMax').show();
	}
	else
	{
		$(str+'1').hide();
		$(str+'2').hide();
		if($('chkSound').checked == true && $('chkPhoto').checked == true && $('chkVideo').checked == true)
		{
		$('lblMax').hide();
		}
	}
}
function forumcomment(form2)
{
	var description=document.getElementById('desc').value;
	if(ltrim(description)=="")
	{
		alert("Comment field should not be left blank.");
		document.form2.description.value=""
		document.form2.description.focus();
		return false;
	}
	if(document.form2.choosesound.value != "")
	{
		if(document.form2.txtSoundloc.value == "")
		{
			alert("Please enter location of recording");
			document.form2.txtSoundloc.value=""
			document.form2.txtSoundloc.focus();
			return false;
		}
		if(document.form2.soundTime.value == "")
		{
			alert("Please enter Date of recording(mm/dd/yyyy)");
			document.form2.soundTime.value=""
			document.form2.soundTime.focus();
			return false;
		}
		if(document.form2.audioHr.selectedIndex=="0")
		{
			alert("Please enter Time of recording(hh, 0-24)");
			document.form2.audioHr.focus();
			return false;
		}
	}
	if(document.form2.choosevideo.value != "")
	{
		if(document.form2.txtVideoloc.value == "")
		{
			alert("Please enter location of recording");
			document.form2.txtVideoloc.value=""
			document.form2.txtVideoloc.focus();
			return false;
		}
		if(document.form2.videoTime.value == "")
		{
			alert("Please enter Date of recording(mm/dd/yyyy)");
			document.form2.videoTime.value=""
			document.form2.videoTime.focus();
			return false;
		}
		if(document.form2.videoHr.selectedIndex=="0")
		{
			alert("Please enter Time of recording(hh, 0-24)");
			document.form2.videoHr.focus();
			return false;
		}
	}
	if(document.form2.choosephoto.value != "")
	{
		if(document.form2.txtPhotoloc.value == "")
		{
			alert("Please enter location of recording");
			document.form2.txtPhotoloc.value=""
			document.form2.txtPhotoloc.focus();
			return false;
		}
		if(document.form2.photoTime.value == "")
		{
			alert("Please enter Date of recording(mm/dd/yyyy)");
			document.form2.photoTime.value=""
			document.form2.photoTime.focus();
			return false;
		}
		if(document.form2.photoHr.selectedIndex=="0")
		{
			alert("Please enter Time of recording(hh, 0-24)");
			document.form2.photoHr.focus();
			return false;
		}
	}
return true;
}
function submitForm()
{
	var ddnumber=$('ddnumber').value;
	if(ltrim(ddnumber)=="")
	{		
		alert("Enter Your DD Number");
		document.loginForm.ddnumber.value=""
		document.loginForm.ddnumber.focus();
		return false;
	}
	if($('question').selectedIndex=="0")
	{
		alert("select your security question");
		document.loginForm.question.focus();
		return false;
	}
	var answer=$('answer').value;
	if(ltrim(answer)=="")
	{
		alert("Enter your answer");
		document.loginForm.answer.value=""
		document.loginForm.answer.focus();
		return false;
	}

	return true;
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
/*---------------------------------------------------------------------------------------------------------*/
function Blur(elem, opacity) {
	
	Element.setOpacity(elem, opacity) 
	
}
/*---------------------------------------------------------------------------------------------------------*/
function showone(itemID1)
{
  	if ((document.getElementById(itemID1).style.display == 'none'))
  	 	{
   		 document.getElementById(itemID1).style.display = 'inline';
 	 	} 
 	 else 
 	 	{
   		 document.getElementById(itemID1).style.display = 'none';
  		}

}
function showDiv(itemID1,itemID2)
{
  	if ((document.getElementById(itemID1).style.display == 'none'))
  	{
   	 document.getElementById(itemID1).style.display = 'inline';
   	 document.getElementById(itemID2).style.display = 'none';
 	} 
 	
} 
function showDiv1(itemID1)
{
  	if ((document.getElementById(itemID1).style.display == 'none'))
  	{
   	 document.getElementById(itemID1).style.display = 'inline';
 	} 
 	
} 
function showTrans(val,itemID2,itemID3)
{
  	if(val=='1')
  	{
  		document.getElementById(itemID2).style.display = 'block';
  		document.getElementById(itemID3).style.display = 'none';
  		document.getElementById("nLabel").style.display='block';
  		document.getElementById("tLabel").style.display='none';
  		document.getElementById("county").style.display='block';
  		document.getElementById("drptype").style.display='none';
  		document.getElementById("TransBrands").style.display='none';
  		$('Error3').hide();		
  	}
  	else if(val=='2')
  	{
  		document.getElementById(itemID3).style.display = 'none';
  		document.getElementById(itemID2).style.display = 'none';
  		document.getElementById("nLabel").style.display='block';
  		document.getElementById("tLabel").style.display='none';
  		document.getElementById("county").style.display='block';
  		document.getElementById("drptype").style.display='none';
  		document.getElementById("TransBrands").style.display='none';
  		$('Error3').hide();

  	}
  	else
  	{
  		document.getElementById(itemID2).style.display = 'none';
  		document.getElementById(itemID3).style.display = 'block';
  		document.getElementById("nLabel").style.display='block';
		document.getElementById("tLabel").style.display='none';
		document.getElementById("county").style.display='block';
		document.getElementById("drptype").style.display='none';
		document.getElementById("TransBrands").style.display='none';
		$('Error3').show();
  	}
  	
 	
}
function showTrans1(val,itemID2,itemID3)
{
  	if(val=='1')
  	{
  		document.getElementById(itemID2).style.display = 'block';
  		document.getElementById(itemID3).style.display = 'none';
  		document.getElementById("tLabel").style.display='block';
  		document.getElementById("nLabel").style.display='none';
		document.getElementById("drptype").style.display='block';
		document.getElementById("county").style.display='none';
		$('Error4').hide();
  	}
  	else if(val=='2')
  	{
  		document.getElementById(itemID3).style.display = 'block';
  		document.getElementById(itemID2).style.display = 'none';
  		document.getElementById("drptype").style.display='none';
  		document.getElementById("nLabel").style.display='block';
  		document.getElementById("tLabel").style.display='none';
  		document.getElementById("county").style.display='block';
  		$('Error4').hide();
  	}
  	else
  	{
  		document.getElementById(itemID2).style.display = 'none';
  		document.getElementById(itemID3).style.display = 'block';
		document.getElementById("drptype").style.display='none';
		document.getElementById("nLabel").style.display='block';
		document.getElementById("tLabel").style.display='none';
		document.getElementById("county").style.display='block';
		$('Error4').show();
  	}
 	
} 
function hideDiv(str,divName)
{
	if(str == "")
	{
		$('Error6').show();
	}
	else
	{
		$('Error6').hide();
	}
}
function getState(id,iso) {

	var params = 'country='+$F('country'+id);
	var id = id;
	
	new Ajax.Request('../'+iso+'/ajax/getState.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
				var response = transport.responseText || "no response text";
				$('state'+id).innerHTML = response;
				},					
		onFailure: function(){ 
				alert('There was an error \n Please try again.')
				}
	});

}
function getCategory(id,str) 
{
		if(str != "")
		{
			$('Error5').hide();
		}
		else
		{
			$('Error5').show();
		}
		$('transCategory'+id).show();
		var params = 'transType='+$F('transType'+id);
		var id = id;
		
		new Ajax.Request('ajax/getTransCategory.php', {
			method:'post',
			parameters: params,
			onSuccess: function(transport){
					var response = transport.responseText || "no response text";
					$('transCategory'+id).innerHTML = response;
					},					
			onFailure: function(){ 
					alert('There was an error \n Please try again.')
					}
		});	
	
}
function getTransCategory(id,str,iso) 
{
		//alert(iso);
		if(str != "")
		{
			$('Error5').hide();
		}
		else
		{
			$('Error5').show();
		}
		$('transCategory'+id).show();
		var params = 'transType='+$F('transType'+id);
		var id = id;
		
		new Ajax.Request('../'+iso+'/ajax/getTransCategory.php', {
			method:'post',
			parameters: params,
			onSuccess: function(transport){
					var response = transport.responseText || "no response text";
					$('transCategory'+id).innerHTML = response;
					},					
			onFailure: function(){ 
					alert('There was an error \n Please try again.')
					}
		});	
	
}

function shownewCatDiv(cat1,div1)
{
	c1=document.getElementById(cat1).options[document.getElementById(cat1).selectedIndex].value;
	//c2=document.getElementById(cat2).options[document.getElementById(cat2).selectedIndex].value;
	//c3=document.getElementById(cat3).options[document.getElementById(cat3).selectedIndex].value;
	//c4=document.getElementById(cat4).options[document.getElementById(cat4).selectedIndex].value;
	//c5=document.getElementById(cat5).options[document.getElementById(cat5).selectedIndex].value;
	//c6=document.getElementById(cat6).options[document.getElementById(cat6).selectedIndex].value;
	//if(c1 =="0" )//|| c2 == "0" || c3 == "0" || c4 == "0" || c5 == "0" || c6 == "0")
	//{
		document.getElementById(div1).style.display = 'block';
		//document.getElementById(div2).style.display = 'none';
	//}
	//else if(c1 !="0")// && c2 != "0" && c3 != "0" && c4 != "0" && c5 != "0" && c6 != "0")
	//{
		//document.getElementById(div2).style.display = 'block';
		//document.getElementById(div1).style.display = 'none';
	//}	
}
function checkOther(cat,div1)
{
	c1=document.getElementById(cat).options[document.getElementById(cat).selectedIndex].value;
	if((c1 != "0") && (document.getElementById(div1).style.display == 'block'))
	{
		document.getElementById('othercat').value='';
		document.getElementById(div1).style.display = 'none';	
	}
	
}

function GetMunic(id) {
	var params = 'province='+$F('province'+id);
	var id = id;
	new Ajax.Request('ajax/getmunic.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
				var response = transport.responseText || "no response text";
				$('munic'+id).innerHTML = response;
				},					
		onFailure: function(){ 
				alert('There was an error \n Please try again.')
				}
	});

}

function checkUsername() {
	var params = 'username='+$F('username');
	var id = id;
	new Ajax.Request('ajax/checkUsername.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
				var response = transport.responseText || "no response text";
				if(response == 'success')
				{
				$('divCheckRes').innerHTML ='';
				}
				else
				{
				$('divCheckRes').innerHTML = response;
				}
				},					
		onFailure: function(){ 
				alert('There was an error \n Please try again.')
				}
	});

}

/*--------------------------------------------------------------------------------------------------------*/
function ChangeColour(elem,inout) {

	if (inout == 1) {
		
		$('Link'+elem).setStyle({ backgroundColor: '#00813f', color: '#fff' });
		$('T'+elem).src = 'gfx/arrows.gif';
		
	} else {
		
		$('Link'+elem).setStyle({ backgroundColor: '#1dc450' }); 
		$('T'+elem).src = 'gfx/arrowsover.gif';
	
	}

}
/*--------------------------------------------------------------------------------------------------------*/
function SwapDD(inout) {

	if (inout == 1) {
		
		$('DDb').setStyle({ backgroundColor: '#00813f', color: '#fff' });
		$('DDs').src = 'gfx/arrows.gif';
		
	} else {
		
		$('DDb').setStyle({ backgroundColor: '#1dc450' }); 
		$('DDs').src = 'gfx/arrowsover.gif';
	
	}

}
/*--------------------------------------------------------------------------------------------------------*/
function Search(inout,id) {

	if (inout == 1) {
		
		$('Sbtn'+id).src = 'gfx/arrows.gif';
		$('Sbt'+id).setStyle({ color: '#fff' }); 
		
	} else {
		
		$('Sbtn'+id).src = 'gfx/arrowsover.gif';
		$('Sbt'+id).setStyle({ color: '#b93737' }); 
	
	}

}
function ComplaintForm(page,path) { 
	var page = page;
	var params = $('DDform').serialize()+'&page='+page+'&action=formsend';
	$('DDform').disable();
	$('Error1').hide();
	$('Error2').hide();
	$('Error3').hide();
	if(page == "complaint"){$('Error4').hide();}
	new Ajax.Request('sendComplaints.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
				var response = transport.responseText || "no response text";
				res = response.split('***');
				errors = res.size();
				if (errors == 1) {
					$('DDform').hide();
					$('ThankYou').show();					
				}
				$('DDform').enable();
				res.each(function(s) {
						$('Error'+s).show();
					});				
				},					
		onFailure: function(){ 
				alert('There was an error \n Please try again.')
				$('DDform').enable();
				}
	});

}

/*--------------------------------------------------------------------------------------------------------*/
function ProcessForm(page,iso,appstatus,lang) {
	var page = page;
	var params = $('DDform').serialize()+'&page='+page+'&action=formsend';
	if ((page=="application") && ($('confirm').checked == false)) { alert('Please accept the rules'); return; }
	if($('password').value == ""){alert('Please enter password');$('password').focus(); return;}
	if($('password').value.length < 6){alert('Password Must be greater than 6 chars');$('password').value="";$('password').focus(); return;}
	if($('password').value != $('cnfrmpswd').value) { alert('Password Mismatch');$('cnfrmpswd').value="";$('cnfrmpswd').focus(); return; }
	
	$('DDform').disable();
	for(var i =1;i <= 23; i++)
	{
		$('Error'+i).hide();
	}
	if(appstatus == 'edit')
	{
	path='../'+lang+'/ajax/sendcontact.php';
	}
	else
	{
	path='ajax/sendcontact.php';
	}
	new Ajax.Request(path, {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
				var response = transport.responseText || "no response text";
				//alert(response);
				res = response.split('***');
				errors = res.size();
				if (errors == 1) {
					$('DDform').hide();
					$('ThankYou').show();
					res1=response.split('|');
					if(res1.size() == 1)
					{
						act = res[0];
						if (act == "free") {
							location.href='../orders/notify.php?type=National&accesstype=Fst&status=T&payment=free';
							return;
						}
						if (act == "order") {
							location.href='../orders/createorder.php?type=National&accesstype=Fst';
							return;
						}
						if (act == "trans") {
							location.href='../orders/createorder.php?type=Transnational&accesstype=Fst';
							return;
						}
					}
					else
					{
						if (res1[0] == "other") 
						{				
							var message=res1[1];
							$('ThankYou1').show();
							$('ThankYou').hide();
							alert(message);
							location.href="application.php#ThankYou1"
							return;
						}
					}
				}
				$('DDform').enable();
				res.each(function(s) {
						$('Error'+s).show();
					});				
				},					
		onFailure: function(){ 
				alert('There was an error \n Please try again.')
				$('DDform').enable();
				}
	});

}
/*--------------------------------------------------------------------------------------------------------*/
function UpdateForm(page,sector) {
	var page = page;
	var params = $('editForm').serialize()+'&page='+page+'&action=formsend';
	$('editForm').disable();
	$('Error1').hide();
	$('Error2').hide();
	$('Error3').hide();
	$('Error4').hide();
	$('Error5').hide();
	$('Error6').hide();
	$('Error7').hide();
	$('Error8').hide();
	$('Error9').hide();
	$('Error10').hide();
	$('Error13').hide();
	if(sector == 3)
	{
		$('Error11').hide();
		$('Error12').hide();
	}	
	new Ajax.Request('ajax/updateApp.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
				var response = transport.responseText || "no response text";
				res = response.split('***');
				errors = res.size();
				if (errors == 1) {
					$('editForm').hide();					
					act = res[0];
					if (act == "done") {
						location.href='viewDetails.php';
						return;
					}		
					
				}
				$('editForm').enable();
				res.each(function(s) {
						$('Error'+s).show();
					});				
				},					
		onFailure: function(){ 
				alert('There was an error \n Please try again.')
				$('editForm').enable();
				}
	});

}
/*--------------------------------------------------------------------------------------------------------*/
function ForumSignUpForm(page) {
	var page = page;
	var path = path;
	var params = $('loginForm').serialize()+'&page='+page+'&action=formsend';
	if ((page=="signup") && ($('terms').checked == false)) { alert('Please accept the Terms of service'); return; }

	$('loginForm').disable();
	$('ThankYou').hide();
	$('Error1').hide();
	$('Error2').hide();
	if(page == 'signup')
	{
	$('Error3').hide();
	$('Error4').hide();
	$('Error5').hide();
	$('Error6').hide();
	$('Error7').hide();
	}
	new Ajax.Request('forumUserlogin.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
				var response = transport.responseText || "no response text";
				res = response.split('***');
				errors = res.size();
				if (errors == 1) {
					act = res[0];
					if(act == 'iso')
					{
					document.location.href='../';
					}
					else if(page == 'signup')
					{
						if (act == "done") {						
							$('tblSignUp').hide();
							$('tblBack').hide();
							$('tblThanks').show();
							$('ThankYou').show();					
						}
						if (act == "failure") {
							$('failure').show();
						}
					}
					else if(page == 'login')
					{
						if(act != '')
						{
						location.href=act;
						return;
						}
					}
					else if(page == 'forgot')
					{
						if(act == 'success')
						{
							$('ThankYou').show();
						}
					}						
										
				}
				$('loginForm').enable();
				res.each(function(s) {
						$('Error'+s).show();
					});				
				},					
		onFailure: function(){ 
				alert('There was an error \n Please try again.')
				$('loginForm').enable();
				}
	});

}
/*--------------------------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------------------------*/
var enableCache = true;
var jsCache = new Array();

var dynamicContent_ajaxObjects = new Array();

function ajax_showContent(divId,ajaxIndex,url)
{
	document.getElementById(divId).innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;
	if(enableCache){
		jsCache[url] = 	dynamicContent_ajaxObjects[ajaxIndex].response;
	}
	dynamicContent_ajaxObjects[ajaxIndex] = false;
}

function ajax_loadContent(divId,url)
{
	if(enableCache && jsCache[url]){
		document.getElementById(divId).innerHTML = jsCache[url];
		return;
	}
	
	var ajaxIndex = dynamicContent_ajaxObjects.length;
	document.getElementById(divId).innerHTML = "<img src='../gfx/loadingemail.gif'> Loading";
	dynamicContent_ajaxObjects[ajaxIndex] = new sack();
	dynamicContent_ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get
	dynamicContent_ajaxObjects[ajaxIndex].onCompletion = function(){ ajax_showContent(divId,ajaxIndex,url); };	// Specify function that will be executed after file has been found
	dynamicContent_ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function	
		
}
function sack(file){
	this.AjaxFailedAlert = "Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";
	this.requestFile = file;
	this.method = "POST";
	this.URLString = "";
	this.encodeURIString = true;
	this.execute = false;

	this.onLoading = function() { };
	this.onLoaded = function() { };
	this.onInteractive = function() { };
	this.onCompletion = function() { };

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.5.0");
		} catch (e) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (err) {
				this.xmlhttp = null;
			}
		}
		if(!this.xmlhttp && typeof XMLHttpRequest != "undefined")
			this.xmlhttp = new XMLHttpRequest();
		if (!this.xmlhttp){
			this.failed = true; 
		}
	};
	
	this.setVar = function(name, value){
		if (this.URLString.length < 3){
			this.URLString = name + "=" + value;
		} else {
			this.URLString += "&" + name + "=" + value;
		}
	}
	
	this.encVar = function(name, value){
		var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
	return varString;
	}
	
	this.encodeURLString = function(string){
		varArray = string.split('&');
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split('=');
			if (urlVars[0].indexOf('amp;') != -1){
				urlVars[0] = urlVars[0].substring(4);
			}
			varArray[i] = this.encVar(urlVars[0],urlVars[1]);
		}
	return varArray.join('&');
	}
	
	this.runResponse = function(){
		eval(this.response);
	}
	
	this.runAJAX = function(urlstring){
		this.responseStatus = new Array(2);
		if(this.failed && this.AjaxFailedAlert){ 
			alert(this.AjaxFailedAlert); 
		} else {
			if (urlstring){ 
				if (this.URLString.length){
					this.URLString = this.URLString + "&" + urlstring; 
				} else {
					this.URLString = urlstring; 
				}
			}
			if (this.encodeURIString){
				var timeval = new Date().getTime(); 
				this.URLString = this.encodeURLString(this.URLString);
				this.setVar("rndval", timeval);
			}
			if (this.element) { this.elementObj = document.getElementById(this.element); }
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					var totalurlstring = this.requestFile + "?" + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
				}
				if (this.method == "POST"){
  					try {
						this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')  
					} catch (e) {}
				}

				this.xmlhttp.send(this.URLString);
				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState){
						case 1:
							self.onLoading();
						break;
						case 2:
							self.onLoaded();
						break;
						case 3:
							self.onInteractive();
						break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;
							self.onCompletion();
							if(self.execute){ self.runResponse(); }
							if (self.elementObj) {
								var elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea"){
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							self.URLString = "";
						break;
					}
				};
			}
		}
	};
this.createAJAX();
}
/* Offset position of tooltip */
var x_offset_tooltip = 0;
var y_offset_tooltip = 0;

/* Don't change anything below here */
var ajax_tooltipObj = false;
var ajax_tooltipObj_iframe = false;
var ajax_tooltip_MSIE = false;
if(navigator.userAgent.indexOf('MSIE')>=0)ajax_tooltip_MSIE=true;

function showimage(externalFile,inputObj)
{
	if(!ajax_tooltipObj)	/* Tooltip div not created yet ? */
	{
		ajax_tooltipObj = document.createElement('DIV');
		ajax_tooltipObj.style.position = 'absolute';
		ajax_tooltipObj.id = 'ajax_tooltipObj';		
		document.body.appendChild(ajax_tooltipObj);	
		
		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		ajax_tooltipObj.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content';
		
		if(ajax_tooltip_MSIE)
		{	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj_iframe.style.position = 'absolute';
			ajax_tooltipObj_iframe.border='0';
			ajax_tooltipObj_iframe.frameborder=0;
			ajax_tooltipObj_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj_iframe);
			ajax_tooltipObj_iframe.style.left = '0px';
			ajax_tooltipObj_iframe.style.top = '0px';
		}
		
	}
	// Find position of tooltip
	ajax_tooltipObj.style.display='block';
	ajax_loadContent('ajax_tooltip_content',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj_iframe.style.width = ajax_tooltipObj.clientWidth + 'px';
		ajax_tooltipObj_iframe.style.height = ajax_tooltipObj.clientHeight + 'px';
	}

	ajax_positionTooltip(inputObj);
}

function ajax_positionTooltip(inputObj)
{
	var leftPos = (ajaxTooltip_getLeftPos(inputObj) - x_offset_tooltip);
	var topPos = ajaxTooltip_getTopPos(inputObj) + 2;
	var tooltipWidth = document.getElementById('ajax_tooltip_content').offsetWidth; 	
	ajax_tooltipObj.style.left = leftPos + 'px';
	ajax_tooltipObj.style.top = topPos + 'px';
		
}

function ajax_hideTooltip()
{
	ajax_tooltipObj.style.display='none';
}

function ajaxTooltip_getTopPos(inputObj)
{		
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}

function ajaxTooltip_getLeftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
  }
  return returnValue;
}

