﻿///Created By Gopal
///Modified Date : 15 April 2009
//----------------------------------------------------------------------------------------------------------------
var lastFile = "";

//----------------------------------------------------------------------------------------------------------------
function chkTxtBxLength(txt,txtDisp,maxLimit)
{
    var len = txt.value.length;
    if(len > maxLimit)
    {
        txt.value = txt.value.substring(0,maxLimit);
         alert('No More Characters Are Allowed');
        txtDisp.value='0';
       
    }
    else
    {
        txtDisp.value=maxLimit-len;
        txtDisp.disabled=true;
    }
}

//----------------------------------------------------------------------------------------------------------------
//To Display video Files.
function PlayVideoFile(cntl,FilePath)
{
    var str='';
    var ScrubberPath = "http://kamadhenu//nessyfruits//SiteVisitor//";
    if(FilePath.indexOf('.flv') != -1)
    {
        str += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        str += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
        str += 'width="500" height="450" VIEWASTEXT>';
        str += '<param name="movie" value="'+ ScrubberPath + 'scrubber.swf?file='+ FilePath + '&bufferTime=3&autoStart=true" />';
        str += '<param name="quality" value="high" />';
        str += '<embed src="'+ ScrubberPath + 'scrubber.swf?file='+ FilePath + '&bufferTime=3&autoStart=true" quality="high" ';
        str += 'pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="250" height="250" /></object>';
    }
    else
    {
        if(document.selection) //IE
        {
            str += '<OBJECT width="500px" height="450px" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>';            
            str += '<PARAM name="autoStart" value="True">';
            str += '<PARAM name="URL" value="'+ FilePath +'">';
            str += '<PARAM name="enabled" value="True">';
            str += '<PARAM name="balance" value="0">';
            str += '<PARAM name="currentPosition" value="0">';
            str += '<PARAM name="enableContextMenu" value="True">';
            str += '<PARAM name="fullScreen" value="False">';
            str += '<PARAM name="mute" value="False">';
            str += '<PARAM name="playCount" value="1">';
            str += '<PARAM name="rate" value="1">';
            str += '<PARAM name="stretchToFit" value="False">';
            str += '<PARAM name="uiMode" value="full">';
            str += '</OBJECT>';
        }
        else //Mozilla Compatible
        {
            str+='<object width="500px" height="450px" type ="video/x-ms-wmv">';
            str+='<param name="src" value="' + FilePath + '" />';
            str+='</object>'; 
        }
    }
    
    cntl.innerHTML = str;        
}
function PlayLink(cntl,Link)
{
    //cntl.innerHTML = "<object width='250px' height='250px'><param name='movie' value='" + Link + "'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='" + Link + "' type='application/x-shockwave-flash' width='425' height='344' allowscriptaccess='always' allowfullscreen='true'></embed></object>";
    cntl.innerHTML = Link;
}

//----------------------------------------------------------------------------------------------------------------
//To trim string/>.
function Trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function LTrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function RTrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
