//--------------------------------------------------------------------------------------------------------- Your Custom JS Functions Here -------

function isdigit(s)
{
    var r,re;
    re = /\d*/i;
    r = s.match(re);
    return (r==s)?1:0;
}


function deletePro(obj, containerID, btnID){
    var bln = confirm('Are you sure you want to delete this record.');  
    if(bln == false) return;    
    var proInfo = obj.id.split('_')[1].split('|');
    var typePoint = proInfo[0];
    var proPoint = proInfo[1];
    cart.delProIndex(typePoint, proPoint);
    cart.showCart(containerID, btnID);
}

function playMedia(files,texts,height,width,type,control,title) {
  if(type == "video")
    embedSource(files,texts,height,width,control);
else
    embedSource_Audio(files,height,width,control,title);
}


function embedSource(files,texts,height,width,control)
{
    var html = "<embed src='/media/play.swf' allowFullScreen='true' autoPlay='true' FlashVars='vcastr_file=";
        html += files+ "&vcastr_title=" + texts + "&IsAutoPlay=1' menu='true' quality='high' width='";
        html += width + "' height='" + height + "' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
        document.getElementById(control).innerHTML = html;
}

function embedSource_Audio(files,height,width,control,title)
{
    var top = (parseInt(height) - 100)/2;
    var left = (parseInt(width) - 300)/2;
    title = "<font style='color:#2F5EC0;font-weight:bold;font-size:16px'>Audio:&nbsp;" + title + "&nbsp;Information</b>";
    var html = "<div style='position:absolute;top:15px;left:15px'>" + title + "</div><div id='S_div' style='position:absolute;top:" + top + "px;left:" + left + "px'><object id='MediaPlayer1' width='300' height='100' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'";
    html += " codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112'";
    html += "align='baseline' border='0' standby='Loading Microsoft Windows Media Player components...' ";
    html += "type='application/x-oleobject'>";
    html += "<param name='URL' value='" + files + "'>"
    html += "<param name='autoStart' value='true'>";
    html += "<param name='invokeURLs' value='false'>";
    html += "<param name='playCount' value='100'>";
    html += "<param name='defaultFrame' value='datawindow'>";
    html += "<embed src='" + files + "' align='baseline' border='0' width='300' height='100'";
    html += " type='application/x-mplayer2'  pluginspage='' name='MediaPlayer1' showcontrols='1' showpositioncontrols='0'";
    html += " showaudiocontrols='1' showtracker='1' showdisplay='0' showstatusbar='1' autosize='0'	showgotobar='0'";
    html += " showcaptioning='0' autostart='1' autorewind='0' animationatstart='0' transparentatstart='0' allowscan='1'";
    html += " enablecontextmenu='1' clicktoplay='0' defaultframe='datawindow' invokeurls='0'></embed></object></div>";
    document.getElementById(control).innerHTML = html;
}

function GetBrowser()
{
   var agt=navigator.userAgent.toLowerCase();
   if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) )
       return "IE";
   else if( ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
         && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
         && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)) )
       return "Netscape";
   else
       return "unknown";
}

function openWindow(url, width, height)
{

var  top=(window.screen.height-height)/2;
  var  left=(window.screen.width-width)/2;
window.open (url, "newwindow", "height=" + height + ", width=" + width + ", top=" + top + ", left=" + left + ", toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no") 

}

function DrawImage(ImgD){
    var image=new Image();
    var iwidth = ImgD.parentNode.parentNode.offsetWidth;
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
        flag=true;
        if(image.width>iwidth){
            ImgD.width=iwidth;
            ImgD.height=image.height * (iwidth /image.width);}
    }
} 

function AddEmbedLabel()
{
    if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) 
    {
        document.write("<embed src='/FLVPlayer_Progressive.swf' flashvars='&amp;MM_ComponentVersion=1&amp;skinName=/Clear_Skin_3&amp;streamName=/CompanyIntro&amp;autoPlay=false&amp;autoRewind=false' quality='high' scale='noscale' width='216' height='174' name='FLVPlayer' salign='LT' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    }
}



