var i = 1;
function rotate_image_main(){
  display_main();
  setTimeout('rotate_image_main()', 2000);
}
function display_main(){

   if(i>6) i=1;
   var imageName="Pictures/MainPage/Main_" + i + ".jpg";
   var obj = document.getElementById("imgTarget");

   obj.setAttribute("src", imageName);
   ++i;
}

function changeImage(num){
   var imageName="Pictures/MainPage/Main_" + num + ".jpg";
   var obj = document.getElementById('imgTarget');
   obj.setAttribute("src", imageName);
}

function replaceImg(num){
   var imageName="Pictures/MainPage/Main_" + num + ".jpg";
   var obj = document.getElementById('imgTarget');
   obj.setAttribute("src", imageName);
}

function checkMouseOn(obj){
    obj.style.fontWeight='bold';
	obj.style.color = 'red';
	obj.style.fontSize = '16pt';
}

function checkMouseOff(obj){
    obj.style.fontWeight='normal';
	obj.style.color = 'black';
	obj.style.fontSize = '10pt';
}

function insert(pathScript) {
  if (pathScript == "") {
     insertToHead ("Scripts/Hyvong.js");
  }else {
     insertToHead(pathScript);
  }
}

function insertToHead (scriptFile) {

  var head = document.getElementsByTagName('head').item(0);
  var scriptTag = document.getElementById('loadScript');
  var script = document.createElement('script');
  
  script.type = 'text/javascript';
  script.id = 'loadScript';
  script.src = scriptFile;
  head.appendChild(script);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(rotate_image_main);





