﻿/****************************************************************************************
* This file is part of the "New Nestle Web Application / Framework - V3".
* Written by Sogeti India for Nestlé Corporate.
****************************************************************************************/

//function to get query string value
function GetQueryStringValue(querystring)
{
 qstr = window.location.search.substring(1);
 qvalue = qstr.split("&");
 for (i=0; i < qvalue.length; i++)
 {
   valueofqstr = qvalue[i].split("=");
   if (valueofqstr[0] == querystring) 
   {
    return "&" + querystring+"="+valueofqstr[1];
   }
 }
 return ''; //if no value passed in querystring
}

function IsDisclaimerRead(source, arguments)
{
   arguments.IsValid = $('.fCheckBox')[0].childNodes[0].checked;
}

//function to Load data
function MenuLoad(loadobj,val,forpage)
{
 if (confirm('Do you really want to load data from Video News Manager Services ?'))
 {
  if(confirm('Loading data cannot be canceled once it has been started. Proceed ?'))
  {
     loadobj.location = forpage+"?val=" + val;
  }
 }
}

//function to publish data
function MenuPublish(publishobj,val,forpage)
{
 if(confirm('Do you really want to publish directories data ?'))
 {
  if(confirm('Publishing cannot be canceled once it has been started. Proceed ?'))
  {
    publishobj.location = forpage+"?val=" + val;
  }
 }
}

/*
//function to export data form videonewsitem page
function MenuExportForItem()
{
 if(confirm('Export cannot be canceled once it has been started. Proceed ?'))
 {
   window.open("VideoNewsDownloadSummaryReport.aspx");
 }
}

//function to export data from videonewsUser page
function MenuExportForUser(exportobj)
{
 if(confirm('Export cannot be canceled once it has been started. Proceed ?'))
 {
   exportobj.location = "VideoNewsUsersReport.axd";
 }
}

function SubmitDownloadSummaryForm()
{
   if(confirm('Export cannot be canceled once it has been started. Proceed ?'))
   {
      var fromMonth, fromYear, toMonth, toYear;

      var obj = document.getElementById('ctl00_PlaceHolderMain_ctl00_ctl00_fromMonthList');
      if(obj != null)
        fromMonth = obj.options[obj.selectedIndex].value;
        
      obj = document.getElementById('ctl00_PlaceHolderMain_ctl00_ctl00_fromYearList');
      if(obj != null)
        fromYear = obj.options[obj.selectedIndex].value;
        
      obj = document.getElementById('ctl00_PlaceHolderMain_ctl00_ctl00_toMonthList');
      if(obj != null)
        toMonth = obj.options[obj.selectedIndex].value;
        
      obj = document.getElementById('ctl00_PlaceHolderMain_ctl00_ctl00_toYearList');
      if(obj != null)
        toYear = obj.options[obj.selectedIndex].value;
        
      var url = 'VideoNewsDownloadSummaryReport.axd?fromMonth=' + fromMonth + '&fromYear=' + fromYear + '&toMonth=' + toMonth + '&toYear=' + toYear;
      obj = document.getElementById('hiddenLink');
      if(obj != null)
      {
        obj.href = url;
        obj.click();
      }
   }
   return false;
}
*/

//function to enable div inside the grid.
function EnableBottomDiv(obj)
{
  if(document.getElementById(obj.id.replace('div1', 'div1_bottom')) != null)
  {
   document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.display = 'block';
   document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.visibility = 'visible';
  }
}

//function to disable div inside the grid.
function DisableBottomDiv(obj)
{
  if(document.getElementById(obj.id.replace('div1', 'div1_bottom')) != null)
  {
   document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.display = 'none';
   document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.visibility = 'hidden'; 
  }
}



//function for FlashPlayer
function GotoPosition(id,id2,b)
{
	var flagInstance = document.getElementById(id2);
	var instance = document.getElementById(id);
	if (instance != null)
	{	
		if(flagInstance.value=='1')
		{
		    instance.GotoPosition(b);
		}
	}
}
/*
//function for FlashPlayer
function resFP($width, $height) {
    $('.flashPlayerContainer').each(function() {
    var obj = this;
        
        if (obj != null) {
            var obj1 = obj.firstChild;
            if (obj1 != null) {
            }
        }
        
        
    });
}
*/

