/**
* @author [cengis]Mihawk
* @version v1.0
* Date:2007-6-21
*/

var ie = (document.defaultCharset && document.getElementById && !window.home);
var opera9 = false;
if (ie){
var ver=navigator.appVersion.split("MSIE")
ver=parseFloat(ver[1])
ie = (ver >=6)
}else if (navigator.userAgent.indexOf("Opera")!=-1) {
var versionindex=navigator.userAgent.indexOf("Opera")+6
if (parseInt(navigator.userAgent.charAt(versionindex))>=9)
opera9 = true;
}
var oswap = (ie || opera9)
if (oswap){
document.write ("<style id='hideObject'> object{display:none;} </style>");
}
objectSwap = function(){
if (!document.getElementsByTagName){
   return;
}
var stripQueue = [];
var objects = document.getElementsByTagName('object');
for (var i=0; i<objects.length; i++){   
   var o = objects[i];
   var h = o.outerHTML;
   var params = "";
   var hasFlash = true;
   for (var j = 0; j<o.childNodes.length; j++) {
    var p = o.childNodes[j];
    if (p.tagName == "PARAM"){
     if (p.name == "flashVersion"){
      hasFlash = detectFlash(p.value);
      if (!hasFlash){
       o.id = (o.id == "") ? ("stripFlash"+i) : o.id;
       stripQueue.push(o.id);
       break;
      }
     }
     params += p.outerHTML;        
    }
   }
   if (!hasFlash){
    continue;
   }  
   if (!oswap){
    continue;
   }
   if (o.className.toLowerCase().indexOf ("noswap") != -1){
    continue;
   }  
   var tag = h.split(">")[0] + ">";   
   var newObject = tag + params + o.innerHTML + " </OBJECT>";
   o.outerHTML = newObject;
}
if (stripQueue.length) {
   stripFlash(stripQueue)
}
if (oswap){
   document.getElementById("hideObject").disabled = true;
}
}

detectFlash = function(version){
if(navigator.plugins && navigator.plugins.length){
   var plugin = navigator.plugins["Shockwave Flash"];
   if (plugin == undefined){
    return false;
   }
   var ver = navigator.plugins["Shockwave Flash"].description.split(" ")[2];
   return (Number(ver) >= Number(version))
} else if (ie && typeof (ActiveXObject) == "function"){
   try{
    var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + version);
    return true;
   }
   catch(e){
    return false;
   }
}
return true;
}

stripFlash = function (stripQueue){
if (!document.createElement){
   return;
}
for (var i=0; i<stripQueue.length; i++){
   var o = document.getElementById(stripQueue[i]);
   var newHTML = o.innerHTML;
   newHTML = newHTML.replace(/<!--\s/g, "");
   newHTML = newHTML.replace(/\s-->/g, "");
   newHTML = newHTML.replace(/<embed/gi, "<span");  
   var d = document.createElement("div");
   d.innerHTML = newHTML;
   d.className = o.className;
   d.id = o.id;
   o.parentNode.replaceChild(d, o);
}
}

var tempFunc = window.onload;
window.onload = function(){
if (typeof (tempFunc) == "function"){
   try{
    tempFunc();
   } catch(e){}
}
objectSwap();
}
function formcheck()
{
	/*--お名前        */
	txtName=document.getElementById("txtName");
	res=isNull(txtName,"お名前を入力してください。");
	
	/*--電話番号        */
	if (!res)
	{
		txtPhone=document.getElementById("txtPhone");
		res=isNull(txtPhone,"電話番号を入力してください。");
	}
		
	/*--メールアドレス        */
	if (!res)
	{
		txtMail=document.getElementById("txtMail");
		res=isNull(txtMail,"メールアドレスを入力してください。");
		res=isEmail(txtMail);
	}

	/*--お問合せ        */
	if (!res)
	{
		txtContent=document.getElementById("txtContent");
		res=isNull(txtContent,"お問合せ内容を入力してください。");
	}
	if (!res)
	{
		
		var form1=document.getElementById("form1");
		form1.submit();
	}

}
function isNull(name, str) {   
	if (name.value.length == "") 
	{        
		alert(str);        
		name.focus();        
		return true;    
	}    
	return false;
}
function isEmail(str){
	var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	if(!myreg.test(str.value)){
		alert('メールアドレスを確認してください。');
		str.focus();
		return true; 
	}
	return false;
}

	
