if(screen.width=="800")
{
	var tablewidths = "762";
}
else
{
	var tablewidths = "972";
	var tableborder= "#51BAEF;"
}
function chr_replace123(str){
		str = str.replace('#040;','\'');
		str = str.replace('#039;','&');
		return unescape(str);
	}
function prevHomeProject(arr)
{
	var html = "";
	var stloop = edloop = "";
	var len = arr.length - 1;
	var start = document.slide.stslide.value;
	var end = document.slide.edslide.value;
	edloop = parseInt(start)-1;
	if(edloop < 0)
		edloop = len;
	stloop = edloop;
	for (y=0; y<3; y++)
	{
		stloop--;
		if(stloop < 0)
			stloop = len;
	}
	document.slide.stslide.value = parseInt(stloop);
	document.slide.edslide.value = parseInt(edloop);

	start = stloop;
	html += "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>";
	for (y=0; y<4; y++)
	{
		var text1 = text2 = "";
		if(arr[start][3] != "")
			text1 = chr_replace123(arr[start][3])
		if(arr[start][4] != "")
			text2 = chr_replace123(arr[start][4])
		if(start > len)
			start = 0;
		html += "<td width='25%' valign='top' align='center'";
		if(y != 0)
			html += " style='background: url("+IMG_SERVER+"/images/citypage/white.gif) no-repeat;'";
		html += "><table width='175px' border='0' cellspacing='0' cellpadding='0' style='font-family:Verdana;font-size:12px; background:#FFFFFF;' >";
		html +="<tr><td align='center'><img src='"+IMG_SERVER+"/upload/feature_img/"+arr[start][0]+"' alt='"+arr[start][5]+"' title='"+arr[start][5]+"' width='140' height='100'></td></tr>";
		html +="<tr><td align='center' style='padding-left:7px;height:30px;' class='new_txt'><b>"+text1+"</b></td></tr>"; 
		html += "<tr><td align='left' style='text-align: justify; color: #4470A1' class='textnopad'><span style='text-align: justify;'>"+text2+"</span></td></tr>";
		//html += "<tr  class='cursor'><td align='right' style='color: #4470A1' class='textnopad'><a href='"+arr[start][1]+"' rel='gb_page_center[700, 480]' class='readmore'><span class='textnopad'><u>more &gt;&gt;</u></a>
		//</span></td></tr>";
		html += "<tr class='cursor'><td align='right' style='color: #4470A1' class='textnopad'><a href='"+arr[start][1]+"'  class='readmore' rel='gb_page_center[700, 480]'><span class='textnopad'><u>more &gt;&gt;</u></a></span></td></tr>";
		html += "</table></td>";
		start++;
		if(start > len)
			start = 0;
	} 
	
	html += "</tr></table>";
	document.getElementById('fp').innerHTML = html;
}
function nextHomeProject(arr)
{
	var html = "";
	var stloop = edloop = "";
	var len = arr.length - 1;
	if(document.slide.stslide.value == "" || document.slide.edslide.value == "")
	{
		var start = 0;
		var end = 3;
		stloop = 0;
		edloop = 3;
		document.slide.stslide.value = '0';
		document.slide.edslide.value = '3';
	}else{
		var start = document.slide.stslide.value;
		var end = document.slide.edslide.value;
		stloop = parseInt(end)+1;
		if(stloop > len)
			stloop = 0;
		edloop = stloop;
		for (y=0; y<3; y++)
		{
			edloop++;
			if(edloop > len)
				edloop = 0;
		}
		document.slide.stslide.value = parseInt(stloop);
		document.slide.edslide.value = parseInt(edloop);
	}

	start = stloop;
	html += "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>";
	for (y=0; y<4; y++)
	{
		var text1 = text2 = "";
		if(arr[start][3] != "")
			text1 = chr_replace123(arr[start][3])
		if(arr[start][4] != "")
			text2 = chr_replace123(arr[start][4])
		if(start > len)
			start = 0;
		html += "<td width='25%' valign='top' align='center'";
		if(y != 0)
			html += " style='background: url("+IMG_SERVER+"/images/citypage/white.gif) no-repeat;'";
		html += "><table width='175px' border='0' cellspacing='0' cellpadding='0' style='font-family:Verdana;font-size:12px; background:#FFFFFF;'>";
		html +="<tr><td align='center'><img src='"+IMG_SERVER+"/upload/feature_img/"+arr[start][0]+"' alt='"+arr[start][5]+"' title='"+arr[start][5]+"' width='140' height='100'></td></tr>";
		html +="<tr><td align='center' style='padding-left:7px;height:30px;' class='new_txt'><b>"+text1+"</b></td></tr>"; 
		html += "<tr><td align='left' style='text-align: justify;' class='textnopad'><span style='text-align: justify;'>"+text2+"</span></td></tr>";
		//html += "<tr class='cursor'><td align='right' style='color: #4470A1' class='textnopad'><a href='"+arr[start][1]+"' rel='gb_page_center[700, 480]' class='readmore'><span class='textnopad'><u>more &gt;&gt;</u></a></span></td></tr>";
		html += "<tr class='cursor'><td align='right' style='color: #4470A1' class='textnopad'><a href='"+arr[start][1]+"' class='readmore' rel='gb_page_center[700, 480]'><span class='textnopad'><u>more &gt;&gt;</u></a></span></td></tr>";
		html += "</table></td>";
		start++;
		if(start > len)
			start = 0;
	} 
	html += "</tr></table>";
	document.getElementById('fp').innerHTML = html;
}
	

function update_banner_clicks(bid,pos,type)
{
	var xmlhttp1 = false;
	//Check if we are using IE.
	try {
	//If the Javascript version is greater than 5.
		xmlhttp1 = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	//If not, then use the older active x object.
		try {
		//If we are using Internet Explorer.
			xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
		//Else we must be using a non-IE browser.
			xmlhttp1 = false;
		}
	}
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp1 && typeof XMLHttpRequest != 'undefined') {
		xmlhttp1 = new XMLHttpRequest();
	}
	var serverPage = '/ssi/popup/clicks-counter.php?case='+pos+'&id=' + bid + '&type=' +type;
	xmlhttp1.open("GET",serverPage,true);
	xmlhttp1.onreadystatechange = function()
	{
		if (xmlhttp1.readyState==4)
		{
			//alert(xmlhttp1.responseText);
		}
	}
	xmlhttp1.send(null);
}
function update_banner_hits(id,type)
{
			//type 1 for update view or type 2 for update clicks
	var xmlhttp1 = false;
	//Check if we are using IE.
	try {
	//If the Javascript version is greater than 5.
		xmlhttp1 = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	//If not, then use the older active x object.
		try {
		//If we are using Internet Explorer.
			xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
		//Else we must be using a non-IE browser.
			xmlhttp1 = false;
		}
	}
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp1 && typeof XMLHttpRequest != 'undefined') {
		xmlhttp1 = new XMLHttpRequest();
	}
	var serverPage = '/ssi/popup/clicks-counter.php?case=sitebanner&id=' + id + '&type=' +type;
	xmlhttp1.open("GET",serverPage,true);
	xmlhttp1.onreadystatechange = function()
	{
		if (xmlhttp1.readyState==4)
		{
			//alert(xmlhttp1.responseText);
		}
	}
	xmlhttp1.send(null);
}
