/*
 * common.js
 *
 */
 
 	//
	//var theCGI = 'https://ngk.apollon.tbn/cgi-bin/english/';
	//var theCGI = 'http://203.180.136.226/cgi-bin/english/';
	//var theCGI = 'https://203.180.136.123/cgi-bin/english/';
	var theCGI = 'https://www.ngk.co.jp/cgi-bin/english/';
	
	// onload event set
	//
	window.onload = function () { 
		swapImage.init();
	}
	
	
	// window
	//
	function fWinClosed(winVar) {
	var ua = navigator.userAgent
		if( !!winVar )
			if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 ) && ua.indexOf('Win')!=-1 ) 
					return winVar.closed
				else return typeof winVar.document  != 'object'
		else return true
	}
	
			// common popup
			function fOpenWin(to,_width,_height){
				if(fWinClosed(tWin)){
					var tWin = window;
					tWin = open(to,'','scrollbars=yes,resizable=yes,toolbar=no,location=yes,directories=no,status=yes,menubar=yes,width='+_width+',height='+_height+'');
					tWin.focus();
				}
			}

			function fOpenInquiry(arg){
				var theURL = theCGI+'inquiry.cgi?type='+arg;
				fOpenWin(theURL,700,600);
			}
			function fOpenSurvey(arg){
				var theURL = theCGI+'survey.cgi?type='+arg;
				fOpenWin(theURL,700,600);
			}
			function fOpenRequest(arg){
				var theURL = theCGI+'request.cgi?type='+arg;
				fOpenWin(theURL,700,600);
			}
			function fOpenCatalog(arg){
				var theURL = theCGI+'catalog.cgi?type='+arg;
				fOpenWin(theURL,700,600);
			}
			function fOpenMsds(){
				var theURL = theCGI+'MTL/msds.cgi';
				fOpenWin(theURL,700,600);
			}
				
	
	// print
	//
	function fPrint(){
		if(document.getElementById || document.layers){
			window.print();
		} else {
			alert("Javascript required.");
		}
	}
	
	
	// tvcm
	function fDispWmv(asxID) {
		document.write('<embed ');
		document.write('type="application/x-mplayer2"');
		document.write('src="'+asxID+'.asx"');
		document.write('name="MediaPlayer"');
		document.write('width="320" height="309"');
		document.write('autoStart="1"');
		document.write('showcontrols="1"');
		document.write('clicktoplay="1"');
		document.write('showstatusbar="1"');
		document.write('displaysize="-1"');
		document.write('showpositioncontrols="0"');
		document.write('>');
		document.write('<\/embed>');
	}
	function fOpenWmv(asxID,_width,_height) {
		document.write('<embed ');
		document.write('type="application/x-mplayer2"');
		document.write('src="'+asxID+'.asx"');
		document.write('name="MediaPlayer"');
		document.write('width="'+_width+'" height="'+_height+'"');
		document.write('autoStart="1"');
		document.write('showcontrols="1"');
		document.write('clicktoplay="1"');
		document.write('showstatusbar="1"');
		document.write('displaysize="-1"');
		document.write('showpositioncontrols="0"');
		document.write('>');
		document.write('<\/embed>');
	}
			function fOpenCM(theURL){
				fOpenWin(theURL,560,570);
			}

	
