
var hover_texts = Array("ANA SAYFA","HAKKIMIZDA","HİZMET ALANLARI","REFERANSLAR","İNSAN KAYNAKLARI","İLETİŞİM","TEKNİK HESAPLAMALAR");
var hover_urls = Array("index.html","about.html","services.html","references.html","humanresources.html","contact.html","calculations.html");

function do_hover(text_index){
	document.getElementById("mDyn").innerHTML = hover_texts[text_index] + "&nbsp;";
}

function do_navigate(text_index){
	window.location.href = hover_urls[text_index];
}


function check_form(form_object){
	if(form_object){
		for(var i=0;i<form_object.elements.length;i++){
			var form_item = form_object.elements[i];
			var form_value = form_item.value;
			var form_length = form_value.length;
			var form_disabled = form_item.disabled;
			
			// number --------------------------------------------------------------------
			var form_command = form_item.attributes.getNamedItem("number");
			if(form_command&&!form_disabled&&isNaN(form_value)){
				if(form_command.value.length>0){alert(form_command.value);}
				form_item.value="";
				form_item.focus();
				return false;
			}
			// number --------------------------------------------------------------------
			
			
			// email ---------------------------------------------------------------------
			var form_command = form_item.attributes.getNamedItem("email");
			var not_req = form_item.attributes.getNamedItem("notreq");
			var execute_action = true;
			if(form_command&&!form_disabled){
				if(not_req&&form_length==0){ execute_action = false; }
				if(execute_action){
					if(!reg_exp(form_value,/^[\w\.\-]+@[\w\.]+$/gim)){
						if(form_command.value.length>0){alert(form_command.value);}
						form_item.value = "";
						form_item.focus();
						return false;
					}
				}
			}
			// email ---------------------------------------------------------------------
			
			// url   ---------------------------------------------------------------------
			var form_command = form_item.attributes.getNamedItem("url");
			var not_req = form_item.attributes.getNamedItem("notreq");
			var execute_action = true;
			if(form_command&&!form_disabled){
				if(not_req&&form_length==0){ execute_action = false; }
				if(execute_action){
					if(!reg_exp(form_value,/^(http\:\/\/)?[\w|\/|\.|\~|\-]+[\.][\w]+$/gim)){
						if(form_command.value.length>0){alert(form_command.value);}
						form_item.value = "";
						form_item.focus();
						return false;
					}
				}
				
			}
			// url   ---------------------------------------------------------------------

			// notempty ------------------------------------------------------------------
			var form_command = form_item.attributes.getNamedItem("notempty");
			if(form_command&&!form_disabled&&form_length==0){
				if(form_command.value.length>0){alert(form_command.value);}
				form_item.focus();
				return false;
			}
			// notempty ------------------------------------------------------------------
			
			// minlength -----------------------------------------------------------------
			var form_command = form_item.attributes.getNamedItem("minlength");
			var error_command = form_item.attributes.getNamedItem("minlength_error");
			if(form_command&&!form_disabled){
				if(form_length<form_command.value){
					if(error_command&&error_command.value.length>0){alert(error_command.value);}
					form_item.focus();
					return false;
				}
			}
			// minlength -----------------------------------------------------------------
			
			// maxchar -------------------------------------------------------------------
			var form_command = form_item.attributes.getNamedItem("maxchar");
			var error_command = form_item.attributes.getNamedItem("maxchar_error");
			if(form_command&&!form_disabled){
				if(form_length>form_command.value){
					if(error_command&&error_command.value.length>0){alert(error_command.value);}
					form_item.value = "";
					for(var q=0;q<form_command.value;q++){ form_item.value+= form_value.charAt(q); }
					form_item.focus();
					return false;
				}
			}
			// maxchar -------------------------------------------------------------------

		}
		return true;
		//return false;
	}
	else {
		alert("check html code! (return check_form(this);)");
		return false;
	}
}

function reg_exp(source_string,reg_pattern){
	var reg = new RegExp(reg_pattern);
	return (reg.test(source_string));
}


function jsPop(source,width,height,center,scroll,x,y){
	var props = "width="+width+",height="+height;
	if(center){
		x = Math.round((window.screen.availWidth-width)/2);
		y = Math.round((window.screen.availHeight-height)/2);
		props+=",left="+x+",top="+y;
	} else{ 
		if(!x){ x = 0; }
		if(!y){ y = 0; }
		props+=",left="+x+",top="+y;
	}
	if(scroll){ props+=",scrollbars=yes,resizable=yes" } else { props+=",scrollbars=no,resizable=no" }
	var oNewWindow = window.open(source,null,props);
	oNewWindow.focus();
}