﻿
function ApplyEffect(path, fIndex, lIndex, objArray, effect, target, timer,func, obj1Val,obj2Val,type){
	if(type=="HTML"){target.innerHTML = obj1Val;}else if(type=="IMAGE"){target.src = obj1Val;}
	if (target.filters  && target.filters[0]){target.filters[0].stop();}
	target.style.filter=effect;
	if (target.filters && target.filters[0]){target.filters[0].apply();}
	if(type=="HTML"){target.innerHTML = obj2Val;}else if(type=="IMAGE"){target.src = obj2Val;}
	if (target.filters && target.filters[0]){target.filters[0].play();}
	setTimeout(func,timer)
}

function shuffle(o){ 
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
};


function replaceString(sString, sReplaceThis, sWithThis) { 
    if (sReplaceThis != "" && sReplaceThis != sWithThis) {
      var counter = 0;
      var start = 0;
      var before = "";
      var after = "";
      while (counter<sString.length) {
        start = sString.indexOf(sReplaceThis, counter);
        if (start == -1){
         break;
         } else {
           before = sString.substr(0, start);
           after = sString.substr(start + sReplaceThis.length, sString.length);
           sString = before + sWithThis + after;
           counter = before.length + sWithThis.length;
          }
        }
      }
    return sString;
}


function hideBorder(path, transparent, width, height) {
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + width + "' height='" + height+ "'>");
	document.write("  <param name='movie' value='" + path + "' />");
	if(transparent=="TRUE"){ document.write("  <param name='wmode' value='transparent' />");}
	document.write("  <param name='quality' value='high' />");
	document.write("  <embed src='" + path + "' quality='high' wmode='transparent'  pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height+ "'></embed>");
	document.write("</object>");
}

