﻿// JScript File

function Back()
{
    history.back(-1);
}

/* send to friend */
function ebc(mode)
{
    if(document.getElementById("F1") != null)
    {
        if(mode) document.getElementById("F1").style.position = 'static';
        else document.getElementById("F1").style.position = 'relative';
    }
}
function email(obj)
{
   var pos=$('#lnkEmail').position()
   var cLeft = pos.left;
   var cTop = pos.top;
   document.getElementById('dvSend').style.left = (cLeft -120) + "px";
   document.getElementById('dvSend').style.top = (cTop + 17 ) + "px";
   document.getElementById('dvSend').style.display = "block";
}

function eclose()
{
   ebc(false); 
   document.getElementById('dvSend').style.display = "none";
   
    if(document.getElementById('imgGalFlash')!=null)
   {
     document.getElementById('imgGalFlash').style.display='block';
   }
}

function getposOffset(what, offsettype)
{
    var totaloffset=(offsettype=="right")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null)
    {
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}

/* Send To friend end */

/* Video player for news related videos starts form here */
function Ovideo() {
    document.getElementById('main1').style.display = 'block';
    document.getElementById('nxt').style.display = 'block';
}
function Cvideo() {
    document.getElementById('main1').style.display = 'none';
    document.getElementById('nxt').style.display = 'none';
    var player = document.getElementById('flvPlayer');
    player.innerHTML = '';
}

/* New Video Gallery */
function PlayMovie1(filename) {
    Ovideo();
    var player = document.getElementById('flvPlayer');
    player.innerHTML = "<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='387' height='302' bgcolor='#000000' id='myFlashMovie' name='myFlashMovie'><param name='movie' value='" + AppPath + "_resources/Global/player/zoom.swf' /><param name='FlashVars' value='videos=" + filename + "&fms=&app=' /><param name='allowFullScreen' value='true' /><param name='quality' value='high'/><embed src='" + AppPath + "_resources/Global/player/zoom.swf' width='387' height='302' bgcolor='#000000' flashvars='videos=" + filename + "&fms=&app=' allowfullscreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  id='myFlashMovie' name='myFlashMovie'/></object>";
    }
/* Video player for news related videos ends here */
function fixScroll() {
    //document.getElementById('main1').style.height = document.getElementById('tblContent').offsetHeight;
    document.getElementById('main1').style.width = screen.width - 23;
    var lPos = (screen.width) ? (screen.width - 300) / 2 : 0;
    document.getElementById('nxt').style.left = lPos + 'px';
    var tPos = (screen.availHeight) ? (screen.availHeight - 440) / 2 : 0;
    document.getElementById('nxt').style.top = tPos + 'px';


    var cleft = 0;
    var cTop = 0;
    var obj = document.getElementById('tdContent');
    if (obj != null) {
        if (obj.offsetParent) {

            while (true) {
                cleft += obj.offsetLeft;
                cTop += obj.offsetTop;
                if (!obj.offsetParent) break;
                obj = obj.offsetParent;
            }
        }
    }
}

function printDoc()
{
    window.print();
}

function cSearch()
	{
	    if(document.getElementById('ctl00_header_txtSearch') != null)
	    {
	        if(document.getElementById('ctl00_header_txtSearch').value == 'search site....')
	        {
	            document.getElementById('ctl00_header_txtSearch').value = '';
	        }
	    }else{
	        if(document.getElementById('header_txtSearch').value == 'search site....')
	        {
	            document.getElementById('header_txtSearch').value = '';
	        }
	    }
	}
	
	function rSearch()
	{
	    if(document.getElementById('ctl00_header_txtSearch') != null)
	    {
	        if(document.getElementById('ctl00_header_txtSearch').value == '')
	            {
	                document.getElementById('ctl00_header_txtSearch').value = 'search site....';
	            }
	    }else{
	        
	        if(document.getElementById('header_txtSearch').value == '')
	            {
	                document.getElementById('header_txtSearch').value = 'search site....';
	            }
	    }
	}
	
	
	function digg()
{
  var diggurl='http://digg.com/submit?phase=2&url='+encodeURIComponent(document.location.href)+' ';
  window.open(diggurl,'DiggWindow');
  //document.getElementById('divShare').style.display = 'none';

}
function twitter()
{
   var twitterurl='http://twitter.com/home?status=Currently reading '+ location.href ;
   window.open(twitterurl,'TwitterWindow');
   //document.getElementById('divShare').style.display = 'none';
}

function Addtofavorites()
{
if (window.sidebar) 
{ // Mozilla Firefox Bookmark		
  window.sidebar.addPanel('CDM-DNA', location.href,"");
 // document.getElementById('divShare').style.display = 'none';
}
else if( window.external )
{ // IE Favorite
 window.external.AddFavorite(location.href, 'CDM-DNA'); 
 //document.getElementById('divShare').style.display = 'none';
}
}

function delicious()
{
   var deliciousurl='http://delicious.com/save?v=5&noui&jump=close&url='+ location.href ;
   window.open(deliciousurl,'DeliciousWindow');
   //document.getElementById('divShare').style.display = 'none';
  
}
function Google()
{
    var Googleurl='http://www.google.com/bookmarks/mark?op=edit&bkmk='+ location.href ;
    window.open(Googleurl,'GoogleWindow');
   // document.getElementById('divShare').style.display = 'none';
}

function Live()
{
    var Liveurl='https://favorites.live.com/quickadd.aspx?marklet=1&url='+ location.href ;
    window.open(Liveurl,'LiveWindow');
    //document.getElementById('divShare').style.display = 'none';
}

function Buzz()
{
    var Buzzurl='http://buzz.yahoo.com/submit/?submitUrl='+ location.href ;
    window.open(Buzzurl,'BuzzWindow');
    //document.getElementById('divShare').style.display = 'none';
    
}
function facebook()
{
var facebookurl='http://www.facebook.com/sharer.php?u='+location.href;
window.open(facebookurl,'FaceBookWindow');
}
function closeShareMe()
{
    document.getElementById('divShare').style.display = 'none';
}

