﻿function SetWaterMarkForTextFields() {
    var txtBoxes = document.getElementsByTagName("input")
    for (var i = 0; i < txtBoxes.length; i++) {
        if (txtBoxes[i].WaterMarkText) {
            txtBoxes[i].style.color = '#999999';
            txtBoxes[i].value = txtBoxes[i].WaterMarkText;
            txtBoxes[i].onfocus = function() {
                if (this.value == this.WaterMarkText) {
                    this.value = '';
                    this.style.color = '#000000';
                }
            }
            txtBoxes[i].onblur = function() {
                if (this.value == '') {
                    this.value = this.WaterMarkText;
                    this.style.color = '#999999';
                }
                else {
                    this.style.color = '#000000';
                }
            }
        }
    }
}
 function trim(string)
 {
	return string.replace(/^\s*/, "").replace(/\s*$/, "");
}
function DisableBackground() {
    iFrm = document.getElementById("ifrmStatus");
    iFrm.style.display = "block";
    iFrm.height = document.body.scrollHeight;
    iFrm.width = '100%';
}
function EnableBackground() {
    iFrm = document.getElementById("ifrmStatus");
    iFrm.style.display = "none";
}
/*Playing mutually exculisive videos  */
var oldWrapper = null;
var oldCode;    

function removeOldPlayer(theOldWrapper, theOldCode) { 
      document.getElementById(theOldWrapper).innerHTML = theOldCode;
}

function createPlayer(theFile, placeholder, video, theWrapper, width, height, displayheight) {
    if (oldWrapper != null) { removeOldPlayer(oldWrapper, oldCode); }

    oldWrapper = theWrapper; 
    oldCode = document.getElementById(oldWrapper).innerHTML; 

    var s = new SWFObject("Controls/mediaplayer.swf", "thePlayerId", width, height, "7");
    s.addParam("allowfullscreen", "true");
    s.addVariable("file", theFile);
    s.addVariable("width", width);
    s.addVariable("height", height);
    s.addVariable("wmode", "opaque");
    s.addVariable("autoscroll", "true");
    s.addVariable("allowscriptaccess", "true");
    s.addVariable("wmode", "opaque");
    s.addVariable("bufferlength", "10");
    s.addVariable("displayheight", displayheight);
    s.addVariable("allowfullscreen", "true");
    s.addVariable("autostart", "true");
    s.addVariable("shuffle", "false");
    s.addVariable("image", "<%=Functions.ImageRootPath %>" + video + "");
    s.addVariable("enablejs", "true");
    s.addVariable("javascriptid", "thePlayerId");

    s.write(placeholder);
}
