﻿

window.onload=function(){
try
{
    HideInfo();// to safeh haye digeh ke niaz be flake(popup) nadaran, mesle search error mideh
}
catch (e)
{}
}

window.onresize =function(){
try
{
favArea();// to safeh haye digeh ke niaz be flake(popup) nadaran, mesle search error mideh
}
catch (e)
{}
}

window.onunload = function(){}; 



function MakeLink()
{
try{ Form.submit();} catch (e){}
}

function $(elementID) {
    return document.getElementById(elementID);
}


var Utility = {
show : function (id)
{
  $(id).style.display = 'block';
  $(id).style.visibility = 'visible';
},
hide : function (id)
{
  $(id).style.display = 'none';
  $(id).style.visibility = 'hidden';
},
IsHidden : function (id)
{

//alert($(id).style.display)
//alert($(id).style.visibility)
  if ($(id).style.display == '' && $(id).style.visibility == '') 
    return null;
  if ($(id).style.display == 'none') 
    return true;
  if ($(id).style.visibility == 'hidden')
    return true;
  return false;
},
fix : function( event )
{
    if (!event) event = window.event
    //if (event.target) {
	//    if (event.target.nodeType == 3) event.target = event.target.parentNode
		
    //} else if (event.srcElement) {
	//    event.target = event.srcElement
    //}
     return event
 },
ShowModalPage : function (DestinationPage,PageHight/*default="180"*/,PageWidth/*default="500"*/,PageScroll/*default=0*/) 
{
		//set optional parameters	
		if (PageHight=="")
			PageHight="180"
		if (PageWidth=="")
			PageWidth="500"
		if (PageScroll=="")
			PageScroll="0"
        var Reload;
        Reload = window.showModalDialog(""+DestinationPage+"",window,'help:0;status:0;scroll:' + PageScroll + ';dialogHeight:' + PageHight + 'px;dialogWidth:' + PageWidth + 'px;') ;
        if (Reload){
			return true;
		}
        if (Reload=='Cancel'){
			return false;
        }
},
getMousePos:  function (e)
{
	e = Utility.fix(e);  
	if('undefined'!=typeof e.pageX){
		mouseX = e.pageX;
		mouseY = e.pageY;
	} else {
		mouseX = e.clientX + document.body.scrollLeft;
		mouseY = e.clientY + document.body.scrollTop;
	}
} 
};

function Showinfo(path){
	favArea();
	$('PersonInfo').contentWindow.location.replace(path)
	Utility.show('thead');
	
//***** Commented by s.saleh  ***** { chon modal ke baz shod mitavanad safheye zir ra click konad
   // $('thepage').style.filter='alpha(opacity=30)';
   // $('thepage').style.opacity = 0.3;
   // $('thepage').style['-moz-opacity'] = 0.3;
   // $('thepage').style['-khtml-opacity'] = 0.3;
//********************************

  
 
}

function HideInfo(){
	Utility.hide('thead');
//***** Commented by s.saleh  ***** { chon modal ke baz shod mitavanad safheye zir ra click konad
    //	$('thepage').style.filter='alpha(opacity=100)';
    //	$('thepage').style.opacity = 1;
    //  $('thepage').style['-moz-opacity'] = 1;
    //  $('thepage').style['-khtml-opacity'] = 1;
//********************************
}


function favArea() {
var x,y;
if (self.innerHeight) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}

cx=x;
cy=y;

var x,y;
if (self.pageYOffset) // all except Explorer
{
	x = self.pageXOffset;
	y = self.pageYOffset;
}
else if (document.documentElement && document.documentElement.scrollTop)
	// Explorer 6 Strict
{
	x = document.documentElement.scrollLeft;
	y = document.documentElement.scrollTop;
}
else if (document.body) // all other Explorers
{
	x = document.body.scrollLeft;
	y = document.body.scrollTop;
}



 var Element = document.getElementById("thead");
// objh = parseFloat(Element.style.height)/2;
//alert(document.documentElement.offsetHeight);
//alert(document.documentElement.clientHeight);
//alert(document.body.clientHeight)
//alert(document.documentElement.scrollTop);


objh =parseFloat(300)/2;
objw =parseFloat(550)/2;
t=Math.floor(Math.round(cy/2)+y-objh);
l=Math.floor(Math.round((cx/2)+x)-objw);
//alert(cx + "." + cy + "." + x + "." + y + "." + t + "." + l );

Element.style.top = t+'px';
Element.style.left  = l+'px';

}
function favArea1() {





 var Element = document.getElementById("thead");
// objh = parseFloat(Element.style.height)/2;
objh =parseFloat(300)/2;
objw =parseFloat(550)/2;
//alert(document.documentElement.offsetHeight);
//alert(document.documentElement.clientHeight);
alert(document.body.clientHeight)
//alert(document.documentElement.scrollTop);

Element.style.top = Math.floor(Math.round(document.documentElement.clientHeight/2)+document.documentElement.scrollTop-objh)-20+'px';
Element.style.left  = Math.floor(Math.round((document.documentElement.offsetWidth/2)+document.documentElement.scrollLeft)-objw)-20+'px';
}


function DoPrint(){
var pp = frames['PersonInfo'];

pp.focus(); 
//$('PersonInfo').contentWindow.print(); 
pp.print();
//			hideallmenus();	
//			div1.style.visibility="hidden";
//			var storeTitle=document.title;
//			document.title="Organization Chart"
//			window.print();
//			document.title=storeTitle;
//			div1.style.visibility="visible";
}

