
isLive=0;
id=0;
a=0;


var reload_after;
var html_content;

//Start this code



function loadBanner(html_content,reload_after,mm)
{
	
	if(id==0){
	a = mm;
	a++;
	
    //myHtml = htmlentities(html_content);
    html_content=unescape(html_content);
    document.getElementById('ajax-banner').innerHTML = html_content;
   

    try {
        clearTimeout(to);
    } catch (e) {}

    to = setTimeout("nextAd()", parseInt(reload_after));
    


	}
}


function nextAd()
{
	
    fullURL= window.location;
	
	if(a==-1){
    	var now = new Date();
    	var url = 'http://www.smtidx.com/live/featProp/smtidx.php?id=5&pos='+a+'&ts=' + now.getTime();
    	
    }
    else {
    	var now = new Date();
    	var url = 'http://www.smtidx.com/live/featProp/smtidx.php?id=5&pos='+a+'&ts=' + now.getTime();
    		
    }
    appendScript(url);     

}

function appendScript(c){
 var a=document.createElement('script');
 a.setAttribute('src',c);
 a.setAttribute('type','text/javascript');
 var b=function(){
  a.onload=null;
  
  a.parentNode.removeChild(a);
  delete(a);
  if(typeof(c.onload)=='function'){
   c.onload();
  }
 },
 f=function(){
  if(a.readystate=='loaded'||a.readyState=='complete'){
   a.onreadystatechange=null;
   b();
  }
 };
 if(navigator.product=='Gecko'){
  a.onload=b
 }else{
  a.onreadystatechange=f;
 }
 document.getElementsByTagName('head')[0].appendChild(a);
 return a;}






function stopAd(){
	try {
        clearTimeout(to);
    } catch (e) {}

    to = setTimeout("nextAd()", parseInt(5000));
}

function liveAd(){
	isLive = 1;
	nextAd();	
}

function notLive(){
	isLive = 0;
	nextAd();

}

function resumeAd(){
	id=0;
	nextAd();
}

var onLoad = 'nextAd();';

window.onload = function () {
	var headID = document.getElementsByTagName("head")[0];         
    var cssNode = document.createElement('link');
    cssNode.type = 'text/css';
    cssNode.rel = 'stylesheet';
    cssNode.href = 'http://www.smtidx.com/live/featProp/css/smtidx.css';
    cssNode.media = 'screen';
    headID.appendChild(cssNode);
	eval(onLoad);
};

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=750,height=250,left = 506.5,top = 293');");
}

function openUrl(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=600,left = 506.5,top = 293');");
}


function next(parray,imgid)
{
    stopAd();
    pict = parray;
    if(i<pict.length-1){
            i++;
            document.getElementById(imgid).src=pict[i];
 }
 else { 
            i=0;
            document.getElementById(imgid).src=pict[i];
        }
    return false;
}

function prev(parray,imgid)
{
    stopAd();
    pict = parray
    if (i>0)
        {
        i--;
        document.getElementById(imgid).src=pict[i];
        }
    else
        {
        i=pict.length-1;
        document.getElementById(imgid).src=pict[i];
        }
    return false;
}

