
// Line-Comment
/* 
Group-Comments
*/

/* 
<script src="kamjp.js" type="text/javascript"></script>
*/



//    pulldown menu 

function MenuOn(x){ 
	obj=document.getElementById("submenu"+x).style.visibility="visible";
}

function MenuOff(x){ 
	obj=document.getElementById("submenu"+x).style.visibility="hidden"; 
}



//   photo menu 

var target = "";
function jump(){
var url = document.form1.select.options[document.form1.select.selectedIndex].value;
if(url != "" ){
if(target == 'top'){
top.location.href = url;
}
else if(target == 'blank'){
window.open(url, 'window_name');
}
else if(target != ""){
eval('parent.' + target + '.location.href = url');
}
else{
location.href = url;
}
}
}

// pop-window1

function ventanaSecundaria (URL){ 
window.open(URL,"ventana1","width=400, height=600, scrollbars=yes, menubar=no, location=no, resizable=no") 
} 



//   pop-window2 

function openwin(url,name,w,h,t,m,d,s){
return window.open(url,name,"resizeable=1,scrollbars=1,width="+w+",height="+h+",toolbar="+t+",menubar="+m+",directories="+d+",status="+s)
}

/*
<a href=# onclick="openwin('***.html','win1',00tatesize,00yokosize,0,0,0,1);return false"></a>
*/




//   pop-window3

function m_win(url,windowname,width,height) {
 var features="location=no, menubar=no, status=no, scrollbars=yes, resizable=yes, toolbar=no";
 if (width) {
  if (window.screen.width > width)
   features+=", left="+(window.screen.width-width)/2;
  else width=window.screen.width;
  features+=", width="+width;
 }
 if (height) {
  if (window.screen.height > height)
   features+=", top="+(window.screen.height-height)/2;
  else height=window.screen.height;
  features+=", height="+height;
 }
 window.open(url,windowname,features);
}

/*
example from :: ttp://amenti.usamimi.info/windowopen.html
<a href="example.html" onclick="m_win(this.href,'mywindow7',400,300); return false;">クリック１</a><br>
<a href="example.html" onclick="m_win(this.href,null,600,400); return false;">クリック２</a><br>
*/



// Gallery image pop-up JustSoPic
// ValleyWebDesigns.com

function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
	if (bgcolor=="") {
		bgcolor="#000000";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  image0Height=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><meta http-equiv="imagetoolbar" content="no"><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to close" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}

/*
<a href="javascript:;" onClick="JustSoPicWindow('images/gallery/livephotos/tbhtour/barcelona/barna_01.jpg','331yoko','500tate','Click screen to close','#000000','hug image','0');return document.MM_returnValue">
*/

