function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function pviiClassNew2(obj, new_style, new_style2) { //v2.7 by PVII
  if(document.getElementById(obj).className==new_style)
  document.getElementById(obj).className=new_style2;
  else
  document.getElementById(obj).className=new_style;
}

function ADPopupWindow()
{
  window.open("/en/ad_popups.asp", "ADPopupWindow", "toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=no, copyhistory=no, width=752, height=550, left=200, top=30");
}

function Newsletter()
{
  window.open("/en/subscribe.asp", "PopupWindow", "toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=400, height=230, left=200, top=30");
}

var IE = document.all?true:false;
	if (!IE) document.captureEvents(Event.MOUSEMOVE)
//	document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = getMouseXY;
	var tempX = 0;
	var tempY = 0;
	function getMouseXY(e) {
	if (IE) { // grab the x-y pos.s if browser is IE
	tempX = event.clientX + document.documentElement.scrollLeft;
	tempY = event.clientY + document.documentElement.scrollTop;
	}
	else {  // grab the x-y pos.s if browser is NS
	tempX = e.pageX;
	tempY = e.pageY;
	}   
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}  
	return true;
	}
	

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { 
  	v=args[i+2]; 
	v=(v=='show')?'visible':(v=='hide')?'hidden':v;
	
    obj.style.visibility=v; 
	obj.style.left = tempX+10+'px';
	obj.style.top = tempY+10+'px';
	}
	
}

function checkall2() {
	for(var i=0; i<document.Contact.elements.length; i++) {
		var e = document.Contact.elements[i];
		if ( e.name != '_allbox' )
			e.checked = document.Contact._allbox.checked;
	}
}


function validation() {
    if (document.Contact.Name.value.length < 1) {
	    window.alert("Please enter your Name and Surname.");
		return false;
	}
    if (document.Contact.Company.value.length < 1) {
	    window.alert("Please enter your company.");
		return false;
	}
   	if (document.Contact.Address.value.length < 1 ) {
	    window.alert("Please enter your address.");
		return false;
	}
   	if (document.Contact.ZipCode.value.length < 1 ) {
	    window.alert("Please enter your Zip code.");
		return false;
	}
	if (document.Contact.State.value.length < 1 ) {
	    window.alert("Please enter your State.");
		return false;
	}
    if (document.Contact.Country.value.length < 1) {
	    window.alert("Please enter your country.");
		return false;
	}
   	if (document.Contact.Email.value.length <5 ) {
	    window.alert("Please enter your e-mail.");
		return false;
	}
	return true;
}

function validation2() {
  if (document.Download_GRAITEC_Revit_Plugin.Name.value.length < 1) {
    window.alert("Please enter your Name and Surname.");
		return false;
	}
  if (document.Download_GRAITEC_Revit_Plugin.Company.value.length < 1) {
    window.alert("Please enter your company.");
		return false;
	}
//  if (document.Download_GRAITEC_Revit_Plugin.Country.value.length < 1) {
//    window.alert("Please enter your country.");
//		return false;
//	}
  if (document.Download_GRAITEC_Revit_Plugin.Email.value.length <5 ) {
    window.alert("Please enter your e-mail.");
		return false;
	}
	if (document.Download_GRAITEC_Revit_Plugin.Email.value.indexOf('@', 0) == -1 || document.Download_GRAITEC_Revit_Plugin.Email.value.indexOf('.', 0) == -1) {
		window.alert("Invalid email address !");
		return false;
	}
  document.Download_GRAITEC_Revit_Plugin.Keycode.value = computeHash(document.Download_GRAITEC_Revit_Plugin.Name.value, document.Download_GRAITEC_Revit_Plugin.Email.value);
  //alert(document.Download_GRAITEC_Revit_Plugin.Keycode.value);
  return true;
}

function validation3() {
	//var objEmail= document.Subscribe.Email.value;
	if (document.Subscribe.Email.value.length <5 ) {
	    window.alert("Please enter your e-mail.");
		return false;
	}
	if (document.Subscribe.Email.value.indexOf('@', 0) == -1 || document.Subscribe.Email.value.indexOf('.', 0) == -1) {
		window.alert("Invalid email address !");
		return false;
	}
	return true;
}

function validation4() {
    if (document.addpost.message.value.length < 8) {
	    window.alert("Please enter your message.");
		return false;
	}
	return true;
}

function validation5() {
	if (document.addthread.threadtitle.value.length < 1) {
	    window.alert("Please enter the title.");
		return false;
	}
    if (document.addthread.message.value.length < 8) {
	    window.alert("Please enter your message.");
		return false;
	}
	return true;
}

function ShowReferenceInfo(nID)
{
	//mediaWindow=window.open(nID,"","toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=no,width=415,height=385");
	mediaWindow=window.open(nID,"","toolbar=no,directories=yes,menubar=yes,scrollbars=yes,resizable=yes,width=415,height=485");
}

function FAQPopupWindow(url)
{
  window.open(url, "", "toolbar=yes, location=no, directories=no, status=no, scrollbars=no, resizable=yes, copyhistory=yes, width=752, height=550, left=200, top=30");
}

function toggleError() {
	var ele = document.getElementById("toggleTextError");
	var text = document.getElementById("displayTextError");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Error code problems";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Error code problems";
	}
} 

function toggleLicense() {
	var ele = document.getElementById("toggleTextLicense");
	var text = document.getElementById("displayTextLicense");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "License file installation problems";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "License file installation problems";
	}
}

function toggleLicenseAS() {
	var ele = document.getElementById("toggleTextLicenseAS");
	var text = document.getElementById("displayTextLicenseAS");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Troubleshooting license file installation";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Troubleshooting license file installation";
	}
} 

function togglePostInstallation() {
	var ele = document.getElementById("toggleTextPostInstallation");
	var text = document.getElementById("displayTextPostInstallation");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Post installation problems";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Post installation problems";
	}
} 

function toggleTasks() {
	var ele = document.getElementById("toggleTextTasks");
	var text = document.getElementById("displayTextTasks");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Common tasks";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Common tasks";
	}
} 

function toggleASInstallBefore() {
	var ele = document.getElementById("toggleTextASInstallBefore");
	var text = document.getElementById("displayTextASInstallBefore");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Before installation";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Before installation";
	}
}

function toggleASInstallStart() {
	var ele = document.getElementById("toggleTextASInstallStart");
	var text = document.getElementById("displayTextASInstallStart");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Starting installation";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Starting installation";
	}
}

function toggleASInstallAfter() {
	var ele = document.getElementById("toggleTextASInstallAfter");
	var text = document.getElementById("displayTextASInstallAfter");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "After installation";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "After installation";
	}
}


