/************* JavaScript By Brankov ******************/
/*var ws = screen.availWidth;
var hs = screen.availHeight;
var wd = document.body.width;
var hd = document.body.height;
var ww = window.availWidth;
var hw = window.availHeight;*/


/*********************** popUp ***************************/

function show_popup(picName, topImg)
{
	var p=window.createPopup();
	var pbody=p.document.body;
	pbody.style.backgroundColor="white";
	pbody.style.border="solid #aaaaaa 1px";
	pbody.innerHTML ='<center><h2>'+picName+'</h2></center>';
	pbody.innerHTML+='<br>';
	pbody.innerHTML+='<center><img src="../images/contstructionlogo.gif" name="'+picName+'" width="300" border="0" id="'+picName+'"></center>';
	pbody.innerHTML+='<br>';
	//pbody.innerHTML+='<a href="javascript: close();">close</a>';
	pbody.innerHTML+='<br>' + topImg + 'px';
	p.show(400,300 + topImg,320,370,document.body);
}

function open_win_pic(picID)
{
param = '/gallery/pic_viewer.php?picID='+picID;
window.open(param,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=580, height=450")
}

function resizeWindow()
{
top.resizeTo(500,300);
}

function open_win(idArticle, idMenu, idLang)
{
param = 'article_viewer.php?idArticle='+idArticle+'&idMenu='+idMenu+'&idLang='+idLang;
window.open(param,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=620, height=600")
}

function open_win_alert(url)
{
window.open(url,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=620, height=450")
}


function deleteRecord(theLink, table)
{
	confirmation = window.confirm('Neao?ie ee noa, ?a eneaoa aa eco?eaoa oice caien?');
    if (confirmation) {
        theLink.href += '&del_is_js_confirmed=1&table='+table;
    }
}

function changeSource(src)
	{
		src = src+document.getElementById('sourceLang').value+"#form";
		//window.alert(src);
		window.open(src,"_top");
		//document.getElementById('menu_form').submit();
	}

function closeWindowTimeOut(timeInterval)
	{
		timeInterval = timeInterval*1000;
		setTimeout('window.close()', timeInterval);
	}

function goBackWindowTimeOut(timeInterval)
	{
		timeInterval = timeInterval*1000;
		setTimeout('window.history.back()', timeInterval);
	}
	
function returnValue(value, target)
	{
		var inputField = window.opener.document.getElementById(target).getElementsByTagName('input')[0];
		if (inputField)
		 inputField.value = value;
		window.close();
		/*
		<input id="ez_depLoc" type="text" style="width: 220px;" size="31" onfocus="if(this.value=='Flying from')this.value='';this.select();" onblur="document.cookie='depLoc='+this.value;if(this.value=='')this.value='Flying from';" name="ez$depLoc"/>
<br/>
<small>
<a id="depLookup" class="lookup" target="_blank" onclick="return openWindow('http://www.lessno.com/modals/airportlookup.aspx?target=auto', 'lookup')" href="http://www.lessno.com/modals/airportlookup.aspx">Airport lookup</a>
</small>*/
   }
	
function refreshReport(form)
	 {
	  document.getElementById(form).submit();  
	 }
	
function refreshSearch(url) //kiwi http://localhost:10085/orders_report.php
	{
		window.location.href = url;
	}
	
	
function getWindowSize()
{
	
}
	
	
function centerPopupWindow()
	{
	var ws = screen.availWidth;
	var hs = screen.availHeight;
	var wd = document.body.width;
	var hd = document.body.height;
	var ww = window.availWidth;
	var hw = window.availHeight;
	
		if (window.navigator.appName != "Microsoft Internet Explorer")
			{
				//wiw = document.getElementById('site').offsetWidth;
				//hiw = document.getElementById('site').offsetHeight;
				wiw = window.innerWidth;
				hiw = window.innerHeight;
			}
		else
			{
				wiw = document.getElementById('site').offsetWidth;
				hiw = document.getElementById('site').offsetHeight;
			}
	
	window.moveTo((ws-wiw)/2,(hs-hiw)/2);
	window.focus();
	//window.alert (ws+' '+hs+' '+wd+' '+hd+' '+ww+' '+hw+' '+wiw+' '+hiw+window.navigator.appName);
	}
	
function centerDiv(divName)
	{
		//window.confirm('Test  '+divName);
	if (document.getElementById(divName))
		{
			
		//window.confirm('Test  '+divName);	
			
		var wdiv = document.getElementById(divName).style.width;
		var hdiv = document.getElementById(divName).style.height;
		
			if (window.navigator.appName != "Microsoft Internet Explorer")
				{
					//wiw = document.getElementById('site').offsetWidth;
					//hiw = document.getElementById('site').offsetHeight;
					wiw = window.innerWidth;
					hiw = window.innerHeight;
				}
			else
				{
					wiw = document.getElementById('site').offsetWidth;
					hiw = document.getElementById('site').offsetHeight;
				}
			//window.alert(wdiv+' - '+hdiv+' '+divName);	
		document.getElementById(divName).style.left = ((wdiv-wiw)/2)+'px';
		document.getElementById(divName).style.top = ((hdiv-hiw)/2)+'px' ;
		//window.alert (ws+' '+hs+' '+wd+' '+hd+' '+ww+' '+hw+' '+wiw+' '+hiw+window.navigator.appName);
		}
	}
	
	
	
function closeDiv(divName)
{
	if (document.getElementById(divName))
	{
		document.getElementById(divName).style.visibility="hidden";
	}
}
	
function submitform()
{
  document.searchform.submit();
}

	
function delete_record(theForm, No)
{
	confirmation = window.confirm('Are you sure that you want to delete this record?');
    if (confirmation) {
       //document.getElementById(theForm).action += '&send=1';
       document.getElementById('confirmed'+ No).value = 1;
	   document.getElementById(theForm).submit();
    }
}	
