﻿// ****************************************************
// *** Common Function in Java Script
// *** Script Created On | Dec 4, 2009***
// ****************************************************

    //To Go Back while Browsing
  	function goBack(){history.go(-1);}
    
    //Get And Check The Browser
    function fnCheckbrowser(){
       var browserName=navigator.appName;         
       if (browserName == "Microsoft Internet Explorer"){fnPrintPage();}
       else{CallPrint();}}
        
       // Alerting print Message whether the User is Sign In Or Not         
        function fnprintMsg(){
            var browserName=navigator.appName; 
            var strMessage;
            if (browserName == "Microsoft Internet Explorer")
             {
              strMessage ="";
             }
             else
             {
              //strMessage ="Our print function is compatible with Internet Explorer and Mozilla Firefox";
             strMessage ="";
             }
             alert("Please sign in to print this page...!" + strMessage);
        }
    
    //To Print a page
    function fnPrintPage()
    {
    window.print();         
    }

  	
  	//To open a Pop Up Window
  	function fnOpenNewWindow(sTmp)
	{
	//if (open_small_win==1)
	//{
	//	if (!win.closed)
	//	{
	//		win.close();
	//	}
	//}
	win=open(sTmp,'', 'toolbar=no, scrollbars=yes, menubar=no, location=no, fullscreen=yes');
    //win=open(sTmp,'', 'toolbar=no,scrollbars=no,menubar=no,location=no, width=509,height=720');
	//win.moveTo(350,110);
	open_small_win=1
	}
	
 /* These functions are used to invisible And visible  During Print Function */
    function fnInvisiVisible(sSrc)
     {
       document.getElementById(sSrc).style.display = 'none';
       document.getElementById(sSrc).style.visibility = 'hidden';
      }
    function fnVisible(sSrc)
     {
      document.getElementById(sSrc).style.display = 'block';
      document.getElementById(sSrc).style.visibility = 'visible';
     }
    /*End functions*/
     
    /* This Function is used to display the Preloader Image*/
     function init(){fnInvisiVisible('loadImg');} 
/*End function*/

/* Get Query string Values */
/* Added on 16/04/09 */
function createRequestObject() 
{
      FORM_DATA = new Object();
        // The Object ("Array") where our data will be stored.
      separator = ',';
        // The token used to separate data from multi-select inputs
      query = '' + this.location;
      qu = query
        // Get the current URL so we can parse out the data.
        // Adding a null-string '' forces an implicit type cast
        // from property to string, for NS2 compatibility.
      query = query.substring((query.indexOf('?')) + 1);
        // Keep everything after the question mark '?'.
      if (query.length < 1) { return false; }  // Perhaps we got some bad data?
      keypairs = new Object();
      numKP = 1;
        // Local vars used to store and keep track of name/value pairs
        // as we parse them back into a usable form.
      while (query.indexOf('&') > -1) {
        keypairs[numKP] = query.substring(0,query.indexOf('&'));
        query = query.substring((query.indexOf('&')) + 1);
        numKP++;
          // Split the query string at each '&', storing the left-hand side
          // of the split in a new keypairs[] holder, and chopping the query
          // so that it gets the value of the right-hand string.
      }
      keypairs[numKP] = query;
        // Store what's left in the query string as the final keypairs[] data.<
      for (i in keypairs) {
        keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
          // Left of '=' is name.
        keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
          // Right of '=' is value.
        while (keyValue.indexOf('+') > -1) {
          keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
            // Replace each '+' in data string with a space.
        }
        keyValue = unescape(keyValue);
          // Unescape non-alphanumerics
        if (FORM_DATA[keyName]) {
          FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
            // Object already exists, it is probably a multi-select input,
            // and we need to generate a separator-delimited string
            // by appending to what we already have stored.
    }
     else 
     {
      FORM_DATA[keyName] = keyValue;
        // Normal case: name gets value.
      }
     }
    return FORM_DATA;
  }
     /*
      FORM_DATA = createRequestObject();
      This is the array/object containing the GET data.
      Retrieve information with 'FORM_DATA [ key ] = value'.
      */
      
  /* End Function */
  
  
 /* Another Function for Get Query String Values */
 /* only Support for IE */
 /* Added on 16/04/09 */
 
function querySt(ji) 
{
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
    ft = gy[i].split("=");
    if (ft[0] == ji) {
    return ft[1];
 }
 }
}
    /*
    var Folder = querySt("Folder");
    var ImageName = querySt("ImageName");

    document.write("Folder :" + Folder);
    document.write("<br>");
    document.write("ImageName :" + ImageName);
    document.write(hu); 
    */
    
/*End Function*/ 

