﻿// ****************************************************
// *** Common Function in Java Script
// *** Script Created On | Oct 13, 2008 ***
// ****************************************************

    //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*/ 


/* Script For Mouse Over */

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  
  if(!d) 
  d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);}
     
  if(!(x=d[n])&&d.all) 
  x=d.all[n]; 
  
  for (i=0;!x&&i<d.forms.length;i++) 
  x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
  x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) 
  x=d.getElementById(n); 
  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  
  document.MM_sr=new Array; 
  
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
   //alert(a.length);
   
   //newURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;   
   //var Url = window.location.protocol + '//' + window.location.host + '/' + 'schoolbees/';
   //var Url = window.location.protocol + '//' + window.location.hostname + '/';
   //alert(Url);
   // a[2] = Url + a[2];  
   a[2] = 'http://www.schoolbees.com/' + a[2];
   //alert(a[2]);   
   document.MM_sr[j++]=x;
      
   if(!x.oSrc) 
   x.oSrc=x.src; 
   x.src=a[i+2];
   }
}


