/******************************************************
OpenWindow Function
Input Parameters:
	******************
	REQUIRE PARAMETERS
	******************
	sFileName : 	file name (string)
	wwidth : 		width of the window (int)
	wheight : 		height of the window (int)
	******************
	OPTIONAL PARAMETERS
	******************
	winname: 	    name of the window (string) 
							Default value : "defaultwindowname"
	scrollbars:		  open window whith scrollbar (yes,no) 
							Default value : "yes"
	top:		  		top coordinates of the window ()
						  	Default value :  Center of the screen
						  	Another Integer Value:		Absolute position
	
******************************************************/
function OpenWin(sFileName,wwidth,wheight,winname,sScrollbars,iTop) {
        // open window
        //alert('ok');
		var topvalue = 0;
		
		if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5) 
			sScrollbars="yes";
		else 
			sScrollbars = "no";
		if(winname == "") 
			winname = "defaultwindowname";
		
		 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
		 if(iTop == "" || arguments.length < 6)   
		 	topvalue = yy;			
		 else
		 	topvalue = iTop;
         options ='resizable=yes, location=no, toolbar=no, status=no, left='+xx+', top='+topvalue+', menubar=no, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);		
        }	

function OpenWindow(sFileName,wwidth,wheight,winname,sScrollbars,iTop) {
        // open window
		var topvalue = 0;
		
		if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5) 
			sScrollbars="yes";
		else 
			sScrollbars = "no";
		if(winname == "") 
			winname = "defaultwindowname";
		
		 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
		 if(iTop == "" || arguments.length < 6)   
		 	topvalue = yy;			
		 else
		 	topvalue = iTop;
         options ='resizable=yes, location=no, toolbar=no, status=no, left='+xx+', top='+topvalue+', menubar=no, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);		
        }	
		
function sendsal(id_it,far)
{
var amm=eval("far.amount"+id_it+".value");   // alert(amm);
 
  location.href=="cart.php?ID_ITEMs="+id_it+"&ammount="+amm+"&adsal";
   
}

function display_subjects()
{
	if(document.search.search_word.value.length==0) 
	{alert ("");
	document.search.search_word.focus();
	return false;
	}
	else return true;
}

	var dom = document.getElementById
	var ns6=dom && !document.all
	var ns4=document.layers
	var ie4=document.all && !dom
	var opr=navigator.userAgent.indexOf("Opera")
	
	function Swap(target) 
	{ 
		if (dom) target = document.getElementById(target).style;  
		if (ns4) target = document.eval(target);
		if (ie4) target = eval(target).style;
		target.display = target.display == "none" ? "" : "none"
	}

function show_media(id)
		{
		window.open('/show.php?show=media&id='+id, 'mediaview','scrollbars=no,status=no,top=0,left=' + (screen.width/2-323) + ',outerwidth=3,width=400,outerheight=5,height=350');
		}	

function elemShowHide(el_id)
{
	if(el=document.getElementById(el_id))
	{
		el.style.display=el.style.display=="none"?"":"none"
	}
	return false;
}


function toUnixTime(iDay, iMonth, iYear) // Convert date to UNIX timestamp format
{
    var humDate = new Date(Date.UTC(iYear, iMonth-1, iDay,
          0, // HOur
          0, // Min
          0  // Sec
		  ));
    return (humDate.getTime()/1000.0);
}
	function Swap_Images(target,id) 
	{ 
		if (dom) target = document.getElementById(target).style;  
		if (ns4) target = document.eval(target);
		if (ie4) target = eval(target).style;
		target.display = target.display == "none" ? "" : "none";
		
		if(id!="")
		{
			if(target.display == "none") 
				document.getElementById(id).src="gfx/menu_side_plus.gif";
			else
			    document.getElementById(id).src="gfx/menu_side_minus.gif";
	    }
	}

	function pprint(elmId)
	{
		if (!elmId) {
			elmId = "print_version";
		}
		if (document.getElementById != null)
		{
			var html = '<HTML>\n<HEAD>\n';
	
			if (document.getElementsByTagName != null)
			{
				var headTags = document.getElementsByTagName("head");
				if (headTags.length > 0)
					html += headTags[0].innerHTML;
			}
	
			html += '\n</HE' + 'AD>\n<BODY id=\"print_page\"><table cellpadding=\"0\" cellspacing=\"0\" align=\"center\" class=\"page\"><tr><td><div class=\"header\"><img src=\"/gfx/logo.jpg\"></div>\n';
	
			var print_versionElem = document.getElementById(elmId);
	
			if (print_versionElem != null)
			{
					html += print_versionElem.innerHTML;
			}
			else
			{
				alert("Could not find the print_version section in the HTML");
				return;
			}
		
			html += '\n<div class=\"footer\"><span>Nimda Aviation</span></div><td><tr></table></BO' + 'DY>\n</HT' + 'ML>';
	
			var printWin = window.open("","printSpecial");
			printWin.document.open();
			printWin.document.write(html);
			printWin.document.close();
	//		if (gAutoPrint)
				printWin.print();
		}
		else
		{
			alert("Sorry, the print ready feature is only available in modern browsers.");
		}
	}