
try
{
var dom = YAHOO.util.Dom;
var ev = YAHOO.util.Event;
var get = dom.get;
}
catch(e){}

var so1;
var video_links = [];

var Browser = {
	Version: function()
    {  
		var version = 999; // we assume a sane browser
		if (navigator.appVersion.indexOf("MSIE") != -1)  
		// bah, IE again, lets downgrade version number 
		version = parseFloat(navigator.appVersion.split("MSIE")[1]);
		return version;
    }
}



function fixPngTransparency(obj){
	try{
		if(document.body.filters){
			pattern=/.png/gi;
			filterFix="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+obj.src+"',sizingMethod='scale');";
			if(obj.src.search(pattern)!=-1){
				obj.style.width=obj.offsetWidth+"px";
				obj.style.height=obj.offsetHeight+"px";
				obj.style.filter=filterFix;
				obj.src="gfx/blank.gif";
			}
		}
	}
	catch(e){
	
	}
}

function fixImages(){
        imageCollection=document.body.getElementsByTagName("IMG");
        for(i=0; i<imageCollection.length; i++){
               fixPngTransparency(imageCollection[i]);
        }
}


// inintialize video list on home page
function initVideos() {

    video_links = get('video_list').getElementsByTagName('a');
    
    ev.addListener(video_links, 'click', function(){
		swapVideo(this,true);
	});
    
}

//load first video in list
function initFirstVideo() {
	swapVideo(video_links[0],false);
}

// swap youtube videos
function swapVideo(videoLink,isAutoplay){

    for (i in video_links) {
        dom.removeClass(video_links[i].parentNode, 'selected');
    }
    
    dom.addClass(videoLink.parentNode, 'selected');
    
    var video = videoLink.href.replace('http://www.youtube.com/watch?v=', '');
	
	var autoplay = (isAutoplay) ? 1 : 0;

    var source = 'http://www.youtube.com/v/' + video + '&hl=en&autoplay='+autoplay;
    
    get('video').innerHTML = "";
    so1 = new SWFObject(source, "video_embed", "480", "410", "8", "#fff");
    so1.write('video');
    
}

// swap registration: new user/registered
function initRegRadios() {
	 var radios = YAHOO.util.Event.on(dom.getElementsByClassName('radio', 'input', 'user_form'), 'click', function(){
        if (dom.hasClass('user_form', 'new_user')) {
            dom.replaceClass('user_form', 'new_user', 'reg_user');
        }
        else {
            dom.replaceClass('user_form', 'reg_user', 'new_user');
        }
    });
}

//init fields with preset text on registration
function initCardNameFields() {
    try{
	    var container = dom.getElementsByClassName('card_name','div','user_form')[0];
	    var lastNameField = dom.getElementsByClassName('last','input',container);
	    var firstNameField = dom.getElementsByClassName('first','input',container);
    	
	    ev.addListener(lastNameField, 'focus', function(){
		    clearInputText('Last name',this)
	    });
    	
	    ev.addListener(lastNameField, 'blur', function(){
		    restoreInputText('Last name',this)
	    });
    	
	    ev.addListener(firstNameField, 'focus', function(){
		    clearInputText('First name',this)
	    });
    	
	    ev.addListener(firstNameField, 'blur', function(){
		    restoreInputText('First name',this)
	    });
    }
    catch(err){}
}

//clear preset text on inputs
function clearInputText(textString,element) {  
    if (element.value == textString) {
        element.value = '';
    } 
}

//restore preset text on inputs
function restoreInputText(textString,element)  {
    if (element.value == '') {
        element.value = textString;
    } 
}


//Init serial number fields
function initSerialNumberFields() {
    try {
        var obj = document.getElementById("Serial1");
        obj.focus();
	    var container = dom.getElementsByClassName('Serial_Number','div','user_form')[0];
	    var inputFields = container.getElementsByTagName('input');
    	
	    ev.addListener(inputFields, 'keyup', function(event){
		    return autoTab(this, this.getAttribute('maxlength'), event);
	    });
    }
    catch(err){}
}

//init card number fields
function initCardNumberFields() {
    try {
	    var container = dom.getElementsByClassName('card_number','div','user_form')[0];
	    var inputFields = container.getElementsByTagName('input');
    	
	    ev.addListener(inputFields, 'keyup', function(event){
		    return autoTab(this, 4, event);
	    });
    }
    catch(err){}
}

//auto tab jumper
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input, len, e){
    var keyCode = (isNN) ? e.which : e.keyCode;
    var filter = (isNN) ? [0, 8, 9] : [0, 8, 9, 16, 17, 18, 37, 38, 39, 40, 46];
    if (input.value.length >= len && !containsElement(filter, keyCode)) {
        input.value = input.value.slice(0, len);
        try {
        input.form[(getIndex(input) + 1) % input.form.length].focus();
        }
        catch(err){};
    }
    
    function containsElement(arr, ele){
        var found = false, index = 0;
        while (!found && index < arr.length) 
            if (arr[index] == ele) 
                found = true;
            else 
                index++;
        return found;
    }
    
    function getIndex(input){
        var index = -1, i = 0, found = false;
        while (i < input.form.length && index == -1) 
            if (input.form[i] == input) 
                index = i;
            else 
                i++;
        return index;
    }
    return true;
}


function trim(sValue)
{
    var trm = ""+sValue;
    trm = trm.replace(/(^\s*)|(\s*$)/g, "");
    return trm;
}

function Is_Number(intNum){
	if(isNaN(intNum) || intNum < 0)
		return false
			
	return true
}
			
function Is_Email(strValue) {
	var objRegExp  = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
	//(^[A-Za-z0-9]([A-Za-z0-9_\.\-]*)@([A-Za-z0-9_\.\-]*)([.][a-z]{3})$)|(^[A-Za-z0-9]([A-Za-z0-9_\.\-]*)@([A-Za-z0-9_\.\-]*)(\.[a-z]{2})(\.[a-z]{2})*$)/i;
	//^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return objRegExp.test(strValue);
}

function checkFields(){
    MyFrom = document.forms.user_form;
	oObj = MyFrom.user_name;
	if (oObj){
	    if (oObj.value == ""){
		    alert(GetAlert('fillusername'))
		    oObj.focus();
		    return false;
	    }
    }
    if (oObj){						
	    if (Is_Email(oObj.value) == false){
		    alert(GetAlert('invalidusername'))
		    oObj.focus();
		    return false;
	    }
    }
	oObj = MyFrom.password;
	if (oObj){
	    if (trim(oObj.value) == ""){
		    alert(GetAlert('fillpassword'))
		    oObj.focus();
		    return false;
	    }
	}			
	return true;
}
function openCiLink() //Flash onClick function
{
    window.location = "register.asp"

}

var oBookWin = null
function SelectBooks(iGuroRef, iUserID, strUGIUD){
	var blnOpenWin = false;
	//alert('iGuroRef = ' + iGuroRef)
	//alert('iUserID = ' + iUserID)
	//oWin = window.open('SelectBooks.asp','BookWin','height=600,width=400,top=200,left=200,status=no,toolbar=no,menubar=no,location=no,resizeable=no')
	//alert(oBookWin)

	if (oBookWin == null)
		blnOpenWin = true
	else if (oBookWin.closed)
		blnOpenWin = true
	
	if (blnOpenWin == true)
		oBookWin = window.open('','BookWin','height=600,width=400,top=200,left=200,status=no,toolbar=no,menubar=no,location=no,resizeable=no')

	document.Books_form.UGID.value = strUGIUD
	document.Books_form.GID.value = iGuroRef
	document.Books_form.UserID.value = iUserID
	document.Books_form.submit();
}


function getCookie(c_name){ //get the value of the version from the cookie
    if (document.cookie.length>0){
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1){ 
        c_start=c_start + c_name.length+1; 
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
      } 
    }
    return "";
}

function setCookie(c_name,value,expiredays){ //Creates a cookie
    var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
    GotoLandPage(value);
}

function checkCookie(){ //Checks for Cookie
    var BKIversion=getCookie('BKIversion');
    if (BKIversion!=null && BKIversion!=""){
        GotoLandPage(BKIversion);
    }
    else{
		if (navigator.cookieEnabled){ 
        setCookie('BKIversion',generateRandom(),365);
        }
        else{
			window.location.href="homepage1.asp"
		}
			
    }

}

function generateRandom(){ //creates a random number according to number of versions
    var rand_no = Math.random();
    rand_no = rand_no * 2;
    rand_no = Math.ceil(rand_no);
    return rand_no;
}

function GotoLandPage(num){ //Loads the main landing page
    switch(parseInt(num)){
        case 1:
        window.location.href="homepage1.asp"
        break;
        
        case 2: 
        window.location.href= "homepage2.asp"
        break; 
        
        default:
        window.location.href="homepage1.asp"
        break;
        
    }
}

function ajaxObject(url, callbackFunction) {  
    var that=this;        
    this.updating = false;  
    this.abort = function() {    
        if (that.updating) {      
        that.updating=false;     
        that.AJAX.abort();      
        that.AJAX=null;   
        }
    }  
    this.update = function(passData,postMethod) {  
        if (that.updating) { return false; }    
        that.AJAX = null;         
    if (window.XMLHttpRequest) {           
        that.AJAX=new XMLHttpRequest();               
    }   else {  
        that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
    } 
    if (that.AJAX==null) {
        return false;    
    }   else {      
        that.AJAX.onreadystatechange = function() {       
            if (that.AJAX.readyState==4) {                 
            that.updating=false;                    
            that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML); 
            that.AJAX=null;                                            
            }                                      
        }                                                      
    that.updating = new Date();                           
    if (/post/i.test(postMethod)) {   
        var uri=urlCall+'?'+that.updating.getTime();    
        that.AJAX.open("POST", uri, true);     
        that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
        that.AJAX.setRequestHeader("Content-Length", passData.length);     
        that.AJAX.send(passData);     
    }   else {      
            var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime()); 
            that.AJAX.open("GET", uri, true);                               
            that.AJAX.send(null);  
    }           
    return true;                  
  }  
} 
    var urlCall = url;        
    this.callback = callbackFunction || function () { };
}


///2009 Set Language to Site
//Read and XML file with Language variables

var xmlDoc = "";

function SetLanguage(strLanguage){
    var Host = (("https:" == document.location.protocol) ? "https://" + document.location.host + "/bestsellers/language/" : "http://" + document.location.host + "/bestsellers/language/");
    var XmlFile = "";
    switch (parseInt(strLanguage)){
        case 1 :
            XmlFile = Host + "en.xml";
        break;
        case 2 :
            XmlFile = Host + "he.xml";
        break;
        case 3 :
            XmlFile = Host + "sp.xml";
        break;
        default:
            XmlFile = Host + "en.xml";
        break;
    }
    var XmlObject = new ajaxObject(XmlFile,SetXmlLanguage);
    XmlObject.update("",'GET');

}

function SetXmlLanguage(responseText,responseStatus,responseXML){
    xmlDoc = responseXML;
}

function GetAlert(AlertNode){
    return (xmlDoc.getElementsByTagName(AlertNode)[0].childNodes[0].nodeValue);
}

function CheckSerial(){
    var obj = document.getElementById("Serial1");
    if (obj.value.length < obj.getAttribute("maxlength")){
        alert(GetAlert('Invalidserial'));
        obj.focus();
        return false;
    }
    var Serial = obj.value + "-";
    var obj = document.getElementById("Serial2");
    if (obj.value.length < obj.getAttribute("maxlength")){
        alert(GetAlert('fillserial'));
        obj.focus();
        return false;
    }
    Serial = Serial + obj.value + "-";
    var obj = document.getElementById("Serial3");
    if (obj.value.length < obj.getAttribute("maxlength")){
        alert(GetAlert('fillserial'));
        obj.focus();
        return false;
    }
    Serial = Serial + obj.value + "-";
    var obj = document.getElementById("Serial4");
    if (obj.value.length < obj.getAttribute("maxlength")){
        alert(GetAlert('fillserial'));
        obj.focus();
        return false;
    }
    Serial = Serial + obj.value + "-";
    var obj = document.getElementById("Serial5");
    if (obj.value.length < obj.getAttribute("maxlength")){
        alert(GetAlert('fillserial'));
        obj.focus();
        return false;
    }
    Serial = Serial + obj.value;
    if (!Is_Serial(Serial)){
        alert(GetAlert('Invalidserial'));
        return false;
    }
}

function Is_Serial(strValue) {
	var objRegExp  = /^[{|\(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[\)|}]?$/
	    return objRegExp.test(strValue);
}


//Book layout functions
function hideAll(x){
  changeDiv("full_"+x,"none");
  changeDiv("movie_"+x,"none");
  changeDiv("shop_"+x,"none");
  changeDiv("tip_"+x,"none");
  changeDiv("Faq","none");
  changeDiv("Share","none");
  changeDiv("View","none");
  changeDiv("Notes","none");
  changeDiv("Facilitators","none");
  changeDiv("History","none");
  changeDiv("My_Coach","none");
  changeDiv("Save","none");
  changeDiv("Clip","none");
  changeDiv("clip","none");
  document.getElementById("MainCintentDiv").style.overflow="hidden";
  ShowHideMainDivScroll()
}


function changeDiv(the_div,the_change){
  var the_style = getStyleObject(the_div);
  if (the_style != false){
    the_style.display = the_change;
  }
}


function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false;
  }
}

function ShowHideMainDivScroll(){
    
    if ((document.getElementById("MainCintentDiv").scrollHeight-(document.getElementById("MainCintentDiv").innerHTML.indexOf('ExternalFile') > 0 ? 30 : 5)) >document.getElementById("MainCintentDiv").offsetHeight){
	    document.getElementById("MainCintentDiv").style.overflow="auto";
    }
}

function showhide(id){

if (document.getElementById){ 
	obj = document.getElementById(id); 
	if(obj != undefined){
	    if (obj.style.display == "none"){ 
		    obj.style.display = "block"; 
		    if(id == "Faq" || id == "View" || id == "Notes" || id == "History"  || id == "Facilitators" || id == "Share") {
			    try{
		        obj = document.getElementById("clip"); 
			    obj.style.display = "none";
			    }
			    catch(e){}
			    try{
		        obj = document.getElementById("MainCintentDiv");
			    obj.style.width="500px";
			    obj.style.overflow="auto";
			    }
			    catch(e){}
			    ShowHideMainDivScroll()
			    }
		    else
			    {
			        clearButtonImage();
			        obj = document.getElementById("clip"); 
				    if(obj != undefined){
				        obj = document.getElementById("MainCintentDiv");
				        if(document.getElementById("ExternalFile")){
				            obj.style.width="820px";
				        }
				        else{ 
					        obj.style.width="420px";
				        }
				    }
				    else{
				        obj = document.getElementById("MainCintentDiv"); 
    //						obj.style.width="820px";
				        if(document.getElementById("ExternalFile")){
				            obj.style.width="820px";
				        }
				        else{ 
					        obj.style.width="420px";
				        }
				    }
			    }
	    }
       else { 
		    obj.style.display = "none"; 
		    obj = document.getElementById("MainCintentDiv"); 
		    obj.style.overflow="hidden";
		    ShowHideMainDivScroll()
	    } 
    } 
}
} 

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var LastDownButton=null;
function ChangesButtonImages(obj,MousePosition){ //Changes picture accroding to mouse position
	var objBackground;
	objBackground = obj.style.background;
	switch(MousePosition) {
		case "normal" :
		obj.style.background = objBackground.replace("hover","normal");
		break;
		case "hover" :
		obj.style.background = objBackground.replace("normal","hover")
		break;
		case "down" :
		if (LastDownButton!=null){
			LastDownButton.style.background = (LastDownButton.style.background).replace("down","normal");
		}
		obj.style.background = (objBackground.replace("normal","down")).replace("hover","down");
		LastDownButton = obj;
		break;
	}
}

function clearButtonImage(){
    var TdArray = new Array();
    var position;
    TdArray = ['tdHelp','tdmyjourney','tdNotes','tdEdit','tdShare']; //Array of id of the buttons
    for (position=0; position< TdArray.length;position++){
        if(document.getElementById(TdArray[position])){
        document.getElementById(TdArray[position]).style.background = document.getElementById(TdArray[position]).style.background.replace("down","normal");
        }
    }
}

function SetScroll(){
    if (screen.height < 768){
        document.body.scroll = 'auto';
        document.body.scroll = 'noscroll';
    }
}


//Flash player functions

//Flash player functions
function CreateFlashObject(width,height,autoPlay,vol,bWithOutline,bIsHeb,extra,FileName) {

  if (typeof(extra) == 'undefined'){extra = 1}
  if (typeof(bWithOutline) == 'undefined'){bWithOutline = false}
  if (typeof(bIsHeb) == 'undefined'){bIsHeb = false}
  if (typeof(autoPlay) == 'undefined'){autoPlay = ''}
  if (typeof(vol) == 'undefined'){vol = 1}

    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
        document.writeln('<scr' +'ipt src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></sc' + 'ript>')
        document.writeln('<scr' +'ipt src="http://html5media.googlecode.com/svn/trunk/src/jquery.html5media.min.js"></sc' + 'ript>')

        document.writeln('<video class="video" poster="" width="'+width+'" height="'+height+'"  controls="" autobuffer="true" autoBuffering="true" autoPlay="' + autoPlay + '"><br>')
        document.writeln('  <source src="http://coaching.streamtv.co.il:1935/coaching/_definst_/mp4:' + FileName.toLowerCase().replace('flv','') + 'mp4/playlist.m3u8" type="video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;"><br>')
        document.writeln('</video>')

        return
    }


  var sHeb =''
  if (bIsHeb == true)
    sHeb ='_H'
    
   if (bWithOutline == true)
      source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS_O" + sHeb + ".swf"
   else
      source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS_new.swf"      
      
      
   if (extra==53 || extra==115)
      source = "http://www.mentorschannel.com/bestsellers/src/showvideo_tk.swf"    
   
   if (extra==156)
      source = "http://www.mentorschannel.com/bestsellers/src/showvideo_rs.swf"  
   
   
   if(extra==115)
     source = "http://www.mentorschannel.com/bestsellers/src/FYP_player.swf"    
   //else if (width == 352)
	//  source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS_352" + sHeb + ".swf"
   //else
      //source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS_320" + sHeb + ".swf"
      
      //source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS" + sHeb + ".swf"
      
    document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="Intro" align="middle">')
    document.writeln('<param name="allowScriptAccess" value="sameDomain" />')
    document.writeln('<param name="allowFullScreen" value="true" />')
    document.writeln('<param name="movie" value="'+source+'" />')
    document.writeln('<param name="quality" value="high" />')
    document.writeln('<param name="wmode" value="transparent">')
    document.writeln('<param name="bgcolor" value="#ffffff" />')
    document.writeln('<embed src="'+source+'" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="Intro" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
    document.writeln('</object>')
}
function CreateFlashObject_old(source,width,height) {
  source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS.swf?SRC=http://storage.blogtv.com/ci-videos/BestSellers/" + source
  document.writeln("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'  width='"+width+"' height='"+height+"' align='middle'>");
  document.writeln("  <param name='allowScriptAccess' value='sameDomain' /><param NAME='wmode' VALUE='transparent' />");
  document.writeln("  <param='allowFullScreen' value=true/>");
  document.writeln("  <param name='movie' value='"+source+"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' />");
  document.writeln("  <embed src='"+source+"' wmode=transparent allowFullScreen=true  quality='high' bgcolor='#ffffff' width='"+width+"' height='"+height+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
  document.writeln("</object>");
}
function CreateFlashObject2(source,width,height) {
  source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS.swf?SRC=http://storage.blogtv.com/ci-videos/BestSellers/" + source
  //alert(source);
  document.writeln("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+width+"' height='"+height+"' align='middle'>");
  document.writeln("  <param name='allowScriptAccess' value='sameDomain' />");
  document.writeln("  <param name='allowScriptAccess' value='sameDomain' />");
  document.writeln("  <param name='movie' value='"+source+"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' />");
  document.writeln("  <embed src='"+source+"' quality='high' bgcolor='#ffffff' width='"+width+"' height='"+height+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
  document.writeln("</object>");
}


 function CreateFlashObjectInDiv(width,height,autoPlay,vol,bWithOutline,bIsHeb,extra,FileName,div) {
  var el,elm;
  elm=document.getElementById(div);
  if (typeof(extra) == 'undefined'){extra = 1}
  if (typeof(bWithOutline) == 'undefined'){bWithOutline = false}
  if (typeof(bIsHeb) == 'undefined'){bIsHeb = false}
  if (typeof(autoPlay) == 'undefined'){autoPlay = ''}
  if (typeof(vol) == 'undefined'){vol = 1}

    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
    el='<scr' +'ipt src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></sc' + 'ript>';
    el+='<scr' +'ipt src="http://html5media.googlecode.com/svn/trunk/src/jquery.html5media.min.js"></sc' + 'ript>';
    el+='<video class="video" poster="" width="'+width+'" height="'+height+'"  controls="" autobuffer="true" autoBuffering="true" autoPlay="' + autoPlay + '"><br>';
    el+='  <source src="http://coaching.streamtv.co.il:1935/coaching/_definst_/mp4:' + FileName.toLowerCase().replace('flv','') + 'mp4/playlist.m3u8" type="video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;"><br>';
    el+='</video>';
    
    elm.innerHTML=el;
    return
    }
    
     if (bWithOutline == true)
          source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS_O" + sHeb + ".swf"
       else
          source = "http://www.mentorschannel.com/bestsellers/src/showvideo_BS_new.swf"      

      
    el='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="Intro" align="middle">';
    el+='<param name="allowScriptAccess" value="sameDomain" />';
    el+='<param name="allowFullScreen" value="true" />';
    el+='<param name="movie" value="'+source+'" />';
    el+='<param name="quality" value="high" />';
    el+='<param name="play" value="true">';
    el+='<param name="wmode" value="transparent">';
    el+='<param name="bgcolor" value="#ffffff" />';
    el+='<embed src="'+source+'" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="Intro" align="middle" play="true" flashvars="autoplay=true&play=true" allowScriptAccess="sameDomain" allowFullScreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    el+='</object>';
    
    elm.innerHTML=el;
    
    }
