﻿// JScript File
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

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 show_hide_box(width, height, borderStyle,dynadiv,newsid) {

  
  var boxdiv = document.getElementById('dynadiv');
  if (boxdiv != null) {
      if (boxdiv.style.display=='none') {
      move_box(boxdiv, width, height);
        boxdiv.style.width = width + 'px';
        boxdiv.style.height = height + 'px';
      boxdiv.style.display='block';
      
       //document.getElementById('dynatable').style.width = width + 'px';
       
    } else
      boxdiv.style.display='none';
    return false;
  }

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', 'dynadiv');
  boxdiv.style.display = 'block';
  boxdiv.style.zIndex = 10000;
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
 
  boxdiv.innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='400px'><tr><td ><div id='container'><div id='header'><div id='header_left'></div><div id='header_main'>Share The Article</div><div id='header_right'></div></div><div id='content'><form name='upform' id='upform' action='sharearticle.php' method='post' enctype='multipart/form-data' target='upload_target' onsubmit='return startUpload();' ><p id='f1_upload_process'>Sending...<br/><img src='images/sending2.gif' /><br/></p><p id='f1_upload_form' align='center'><br/><label>From: <input name='from_email' id='from_email' type='text' size='30' /></label><br /><br /><label>To : <input name='to_email' id='to_email' type='text' size='30' /></label><br /><label><input type='submit' name='submitBtn' class='sbtn' value='Send' /></label></p><iframe id='upload_target' name='upload_target' src='#' style='width:0;height:0;border:0px solid #fff;'></iframe><input type='hidden' name='newsid' id='newsid' value='"+newsid+"' /></form></div><div id='footer'><a href='#' onclick='closediv("+ width+","+ height+",\""+ borderStyle+"\",\""+dynadiv+"\","+ newsid+")'>Close</a></div></div></td></tr></table>";
  
   document.body.appendChild(boxdiv);
 
  move_box(boxdiv, width, height);

  return false;
}

function canvasHeight1()
    {
      if (window.innerHeight != null)
        return window.innerHeight;
      if (document.body.clientHeight != null)
        return document.body.clientHeight;
      return null;     
    }
    
    function canvasWidth()
    {
      if (window.innerWidth != null)
        return window.innerWidth;
      if (document.body.clientWidth != null)
        return document.body.clientWidth;
      return null;     
    }  

function showdiv()
{

document.getElementById('Layer1').style.height='auto';
document.documentElement.style.overflow = 'hidden';
document.body.style.overflow = 'hidden';
document.getElementById('Layer1').style.height=canvasHeight()+'px';
document.getElementById('Layer1').style.width=canvasWidth()+'px';
}

function hidediv()
{
document.getElementById('Layer1').style.height='0';
document.documentElement.style.overflow = '';
document.body.style.overflow = '';
document.getElementById('Layer1').style.height='0';
document.getElementById('Layer1').style.width='0';
}


function popupdiv()
{
showdiv();
show_hide_box(500, 210, '2px solid','uploaddiv',newsid)

}

function move_box( box, w, h) {
  box.style.left = (canvasWidth()-w)/2+'px';
  box.style.top = (canvasHeight1()-h)/2+'px';
}

function closediv(width, height, borderStyle, dynadiv,newsid)
{
    show_hide_box( width, height, borderStyle ,dynadiv,newsid)
    hidediv();
}

function canvasHeight()
    {
     var scnHei;
     if (document.body) // other Explorers
	    {
		    scnHei = document.body.scrollHeight;
	    }  
	     else if (document.documentElement && document.documentElement.clientHeight)
		    // Explorer 6 Strict Mode
	    {
		    scnHei = document.documentElement.scrollHeight;
	    }
	    else if (self.innerHeight) // all except Explorer
	    {
		    scnHei = self.scrollHeight;
	    }
	    
      return scnHei;
   }  
   
function callfunc(newsid)
{

  showdiv();
  show_hide_box(400, 400, '0px solid','sendhint',newsid);
}



