var newWind;
var lOpened=false;

function openmap(cPicture,nWidth,nHeight,cTitle,cCopyright,cColor,cInfo,cX,cY,cArrow){
	 var output;
	 var NegativeColor;
	 var scroll_flag;
	 var cTitleWindow;
	 var cWinWidth;
	 var cWinHeight;

	if ((nWidth=="nWidth") || (nWidth=="")){
	   nWidth=0;
	   }

	if ((nHeight=="nHeight") || (nHeight=="")){
	   nHeight=0;
	   }

	if ((cX=="cX") || (cX=="")){
	   cX=0;
	   }

 	if ((cY=="cY") || (cY=="")){
	   cY=0;
	   }


	if (lOpened){
	   //newWind.close();
	}
	switch (cArrow)
        {
          case "left":
             cArrow="map_arrow-" + cArrow+".gif";
			 cY=cY-15;
             break;
          case "right":
             cArrow="map_arrow-" + cArrow+".gif";
			 cY=cY-15;
			 cX=cX-30;
             break;
          case "down":
             cArrow="map_arrow-" + cArrow+".gif";
 			 cY=cY-30;
			 cX=cX-15;
            break;
          case "up":
             cArrow="map_arrow-" + cArrow+".gif";
 			 cX=cX-15;
             break;
          default:
             cArrow="map_star.gif";
 			 cY=cY-15;
			 cX=cX-15;
             break;
          }

	cArrow="cs_images/"+cArrow;

	if ((cInfo=="") || (cInfo=="cInfo")){
	   cInfo="<br>Yellow sign indicates objective location.";
	   }

	cTitleWindow=cTitle;
	if (cTitle=="" || cTitle=="cTitle"){
	   cTitleWindow="Map";
	   }

	if (cColor=="black"){
	    cColor="black";
	    NegativeColor="white";
	   }
	  else{
			  if ((cColor=="") || (cColor="cColor")){
	      cColor="#ebedf1";
	      NegativeColor="black";
					}
					else{
					  NegativeColor="black";
	    }
			 }

	if ((cCopyright=="") || (cCopyright=="cCopyright")){
	   //cCopyright="Copyright <a href='/gabrield/cv.asp' class='link'>Gabriel Ditu</a>";
	   //cCopyright="Courtesy of <a href='rd.asp?url=3w;ausway;com;au'; target='_blank'; return false;\">Ausway Group</a>.<br>";
	   cCopyright="Courtesy of Ausway Group<br>";
	  }

 lOpened=true;
 scroll_flag=false;

	 cWinHeight=nHeight+120;
	 if (cWinHeight>screen.availHeight){
	    scroll_flag=true;
	    cWinHeight=screen.availHeight-20;
	    }

	 //add left + right margin from the body tag
	 cWinWidth=nWidth+60;
	 if (cWinWidth>screen.availWidth){
	    scroll_flag=true;
	    cWinWidth=screen.availWidth-40;
	    }

	 if (scroll_flag==true){
		  newWind=window.open("","winnam","height="+cWinHeight+",width="+cWinWidth+",scrollbars=yes,resizable=yes,top=8px,left=8px");
		  }
		 else{
		  newWind=window.open("","winnam","height="+cWinHeight+",width="+cWinWidth+",scrollbars=no,resizable=yes,top=8px,left=8px");
		  }


	 //starting the HTML code
	 output="<html><head>";
	 output+="<title>"+cTitleWindow+"</title>";

	 //style sheet
	 output+="<style type='text/css' media='screen'>";
	 output+="body{color: "+NegativeColor+"; font-size: 11px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-weight: bold; background-color:"+cColor+";";
	 output+="scrollbar-arrow-color: "+NegativeColor+"; scrollbar-track-color: "+cColor+"; scrollbar-face-color: "+cColor+";text-align:center;margin-top:10px;}";
	 output+="#map{position: relative; background-image: url("+cPicture+");height: "+nHeight+"px;width:"+nWidth+"px; border: 1px solid black;}";
	 output+="#arrowpos{position: absolute; top:"+cY+"px; left: "+cX+"px;}";
	 output+=".content{font-weight: normal; font-size: 11px;}";
	 output+=".button_caption{color: black;font-weight: normal}";
	 output+=".title{font-size: 15px; font-weight: bold;}";
	 output+=".link{text-decoration: none;}";
	 output+=".link:hover{color: #ff6600; text-decoration: underline;}";
	 output+=".italiccontent{font-weight: italic}";
	 output+="</style>";

	 //declare other javascript functions
	 output+="<script language='javascript'>";
	 output+="function unhidden(){document.body.style.overflow='';}";
	 output+="function hidden(){document.body.style.overflow='hidden';}";
	 output+="function launchwin(winurl,winname,winfeatures){newwin = window.open(winurl,winname,winfeatures);newwin.focus();}";
     output+="</script>";

	 output+="</head>";
	 output+="<body>";

	 output+="<table border=0 cellpadding=0 cellspacing=4px align=center>";
	 output+="<tr><td align=center><span class='title'>"+cTitle+"</span><br></td>";

    output+="<tr><td><div id='map'><span id='arrowpos'><img src='"+cArrow+"' border='0'></span></div></td></tr>";

     output+="<tr><td align=right valign=top height=12><nobr><span class='content'>"+cCopyright+"</span></nobr></td></tr>";
	 output+="<tr><td align=center><span class='content'>"+cInfo+"</span><br></td></tr>";
	 output+="</table>";

	 output+="</body></html>";

	 newWind.document.write(output);
	 newWind.document.close();
	 newWind.focus();
}


