/************************************************************************************************************/
// JavaScript Document
//(C) www.clipsharevideomod.com
//
//Terms of use:
//Property of www.clipsharevideomod.com. You may not
//redistribute, sell or repost this script.
/************************************************************************************************************/

var current=null;


function startVidThumbChange(index, num_thumbs, thumb, targetlink, base_url)
{	
  if (current!=null) { endVidThumbChange('','',current); }
		current=thumb;

  so = new SWFObject(base_url +'/player2.swf','mpl','120','90','9', "#111111");
  so.addParam('allowscriptaccess','always');
  
  so.addVariable('file', base_url +'/videothumb/' + thumb + '.flv');
  so.addVariable('controlbar', 'none');
  so.addVariable('displayclick', 'link');
  so.addVariable('linktarget', '_self');
  so.addVariable('link', targetlink);
  so.addVariable('autostart', 'true');
  so.addVariable('repeat', 'always');
  so.addVariable('icons', 'false');
  so.addVariable('screencolor', '111111');
  

	
  var obj = document.getElementById('F'+thumb);
  var correction;
    if(document.all) { // IE
	objWidth=obj.offsetWidth;
	objHeight=obj.offsetHeight;
	correction =0;
	}
	else { // Mozilla
		objWidth=parseInt(document.defaultView.getComputedStyle(obj, '').getPropertyValue('width'));
		objHeight=parseInt(document.defaultView.getComputedStyle(obj, '').getPropertyValue('height'));
		correction=0;
	}
	
	objLeft=getLeftPos(obj);
	objTop=getTopPos(obj);
	
//Create a placeholder for the player 
   var newdiv = document.createElement('div');
   newdiv.setAttribute('id','PL' + thumb);
   newdiv.style.width = objWidth;
   newdiv.style.height = objHeight;
   newdiv.style.position = "absolute";
   newdiv.style.left = (objLeft+correction)+'px';
   newdiv.style.top = (objTop +correction) + 'px';
   newdiv.style.padding = obj.style.padding;
   newdiv.style.zIndex = '2';
   newdiv.style.background = obj.style.background;
   newdiv.style.border = obj.style.border;
   newdiv.onmouseout = function(){setTimeout("endVidThumbChange('','', '" + thumb + "')", 50)};
   newdiv.innerHTML = "";
   document.body.appendChild(newdiv);

// ********************************************

  so.write('PL' + thumb);
    
 
}

function endVidThumbChange(index, thumb,thumb2){
	var obj = document.getElementById('PL'+thumb2);
	if(obj) document.body.removeChild(obj);
	current = null;
	}
	
function donothing(){}

function tracecall(aMsg) {
setTimeout(function() { throw new Error("[debug] " + aMsg); }, 0);
}

function getLeftPos(inputObj)
{

  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
  }
  
  return returnValue;
}

function getTopPos(inputObj)
{		
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}


