var scrllTmrH;
var scrllTmrV;
//window.onload =inisial;
var myCars=new Array();
var idobj
function inisial(div_body,div_isi,direc,spd)
{

	idobj=idobj+1;
	myCars[idobj]=spd;
	if(direc=='h') 	
	{


		document.getElementById(div_body).style.overflow = 'hidden';
		document.getElementById(div_isi).style.float = 'left';
		document.getElementById(div_isi).style.position = 'relative';
		cw = parseInt(document.getElementById(div_body).offsetWidth);
		w = parseInt(document.getElementById(div_isi).offsetWidth);
		//w = parseInt(document.getElementById('txt_run').offsetWidth);
		lft = cw +50;
		document.getElementById(div_isi).style.left = lft + "px";
		scroll_H(div_isi,cw,w,lft);
	}
	if(direc=='v') 
	{
		
		document.getElementById(div_body).style.overflow = 'hidden';
		document.getElementById(div_isi).style.float = 'none';
		document.getElementById(div_isi).style.position = 'relative';
		ch = parseInt(document.getElementById(div_body).offsetHeight);
		h = parseInt(document.getElementById(div_isi).offsetHeight);
		tot = ch + 50;
		document.getElementById(div_isi).style.top = tot + "px";
		scroll_V(div_isi,ch,h,tot);
	}
}
function scroll_H(div_isi,cw,w,lft)
{
	w = parseInt(document.getElementById(div_isi).offsetWidth);
	//w = parseInt(document.getElementById('txt_run').offsetWidth);
	if(lft <= w * -1)
	{
		
		
		document.getElementById(div_isi).innerHTML= refres_isi('refresh_flash_h.php');
		document.getElementById(div_isi).style.float = 'left';
		document.getElementById(div_isi).style.position = 'relative';
		w = parseInt(document.getElementById(div_isi).offsetWidth);
		
		lft = cw +50;
	}
	document.getElementById(div_isi).style.left = lft + "px";
	
	//wait and do next...
	if(scrllTmrH) clearTimeout(scrllTmrH);

	scrllTmr = setTimeout("scroll_H('"+ div_isi + "'," + cw + "," + w + "," +  (lft - 1) + ")",myCars[idobj]);
}

function scroll_V(div_isi,ch,h,tot)
{
	h = parseInt(document.getElementById(div_isi).offsetHeight);
	//calc and do step
	if(tot <= h * -1) 	
	{
		document.getElementById(div_isi).innerHTML= refres_isi('refresh_flash_v.php');
		document.getElementById(div_isi).style.float = 'none';
		document.getElementById(div_isi).style.position = 'relative';
		h = parseInt(document.getElementById(div_isi).offsetHeight);
		tot = ch +50;
	}
	document.getElementById(div_isi).style.top = tot + "px";
	
	//wait and do next...
	if(scrllTmrV) clearTimeout(scrllTmrV);
		//vari=
	scrllTmr = setTimeout("scroll_V('"+ div_isi + "'," + ch + "," + h + "," +  (tot - 1) + ")",myCars[idobj]);

}


function refres_isi(url)
			{


				
				var tujuan =url;
				//alert(tujuan);
					var http_temp = false;

					if (window.XMLHttpRequest) 
					{ // Mozilla, Safari,...
						http_temp = new XMLHttpRequest();
						if (http_temp.overrideMimeType) 
						{
							http_temp.overrideMimeType('text/xml');
						}
						
					} 
					else if (window.ActiveXObject) 
					{ // IE
					
						try {
							http_temp = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							try {
								http_temp = new ActiveXObject("Microsoft.XMLHTTP");
							} catch (e) {}
						}
					}
					if (!http_temp) {
						alert('Giving up :( Cannot create an XMLHTTP instance');
						return false;
					}
					
					http_temp.onreadystatechange=function()
					{
						if (http_temp.readyState == 4) 
						{
							if (http_temp.status == 200) 
							{
								var dataku=http_temp.responseText;
								
								//return dataku;

								//document.getElementById(divid).focus();
								


							} 
							else 
							{
								var dataku='Permintaan atau Script anda munkin bermasalah .........!!!!';
								//document.getElementById(divid).innerHTML = dataku;
								//document.getElementById(divid).focus();
							}
						}
					}
					

					http_temp.open('GET', tujuan, false);
					http_temp.send(null);
					return http_temp.responseText;

				}