function submitForm()
{
document.searchform.submit();
}

function expand (id)
{
h=document.getElementById("in_"+id).offsetHeight;

var seg=h/10;

x=id; 

hh1=seg*0.1; 
setTimeout("expo(hh1,x)",30);
hh2=seg*0.4; 
setTimeout("expo(hh2,x)",60);
hh3=seg*0.9; 
setTimeout("expo(hh3,x)",90);
hh4=seg*1.6; 
setTimeout("expo(hh4,x)",120);
hh5=seg*2.5; 
setTimeout("expo(hh5,x)",150);
hh6=seg*3.6; 
setTimeout("expo(hh6,x)",180);
hh7=seg*4.9; 
setTimeout("expo(hh7,x)",210);
hh8=seg*6.4; 
setTimeout("expo(hh8,x)",240);
hh9=seg*8.1; 
setTimeout("expo(hh9,x)",270);
hh10=seg*10; 
setTimeout("expo(hh10,x)",300);
document.getElementById(id).className="dropdown_open";
//document.getElementById(id+"_expand_on").className="drop_button";
//document.getElementById(id+"_expand_off").className="fade1";
}

function expo(hh,id)
{
if(document.getElementById(id).className!=="dropdown_opened")
{
document.getElementById(id).style.height=hh+"px";
}
}


function chcl(x,y)
{
document.getElementById(x).className=y;
}


function minimize (id)
{

if(document.getElementById(id).className!=="dropdown_opened")
{

h=document.getElementById("in_"+id).offsetHeight;
var seg=h/10;

x=id; h=h;

hh1=h-seg*1; 
setTimeout("expo(hh1,x)",30);
hh2=h-seg*2; 
setTimeout("expo(hh2,x)",60);
hh3=h-seg*3; 
setTimeout("expo(hh3,x)",90);
hh4=h-seg*4; 
setTimeout("expo(hh4,x)",120);
hh5=h-seg*5; 
setTimeout("expo(hh5,x)",150);
hh6=h-seg*6; 
setTimeout("expo(hh6,x)",180);
hh7=h-seg*7; 
setTimeout("expo(hh7,x)",210);
hh8=h-seg*8; 
setTimeout("expo(hh8,x)",240);
hh9=h-seg*9; 
setTimeout("expo(hh9,x)",270);
hh10=h-seg*10; 
setTimeout("expo(hh10,x)",300);
//document.getElementById(id+"_expand_off").className="drop_button";
//document.getElementById(id+"_expand_on").className="fade1";
y="dropdown";
document.getElementById(x).className=y;

}
}

function away()

{
var e=window.event.type;
document.getElementById("mimik").I
setTimeout("away()",1000);
}

function stay(id)
{

document.getElementById(id).style.height=document.getElementById("in_"+id).offsetHeight+"px";
document.getElementById(id).className="dropdown_opened";
}

function move_it(id,cl)
{
x=id;
document.getElementById(id).className="dropdown";
setTimeout("minimize(x)",10);
}


function clearthis()
{

document.contact_form.linename.value="";
}


function formchecker(theForm) {
	var allvalid = true;
	var alertstr = "";
	var validstr = "All form data is correct.\n\n";
	var num_of_elements = theForm.length;
	var radio_selected = false;
	var checkbox_selected = false;
	 var ema=0;
	 var aster=0;

	for (var i=0; i<num_of_elements; i++) {
		var theElement = theForm.elements[i];
		var element_type = theElement.type;
		var element_name = theElement.name;
		var element_value = theElement.value;

// Check Text boxes ...
		if (element_type == "text") {
			var checkstr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-/*,...'@~#%$��!���(){}[ ]?:;=\|"+'"'+'\n\r\f';
			if (element_value.length == 0) {
				alertstr += "Form element '" + element_name + "' contains no data.\n\n";
				allvalid = false;
			} else {
				var badchars = "";
				for (var j=0; j<element_value.length; j++) {
				
				
				if(element_value.charAt(j)=="*"){ aster++; }
				
				
				if(element_name=="email")
				{
				if(element_value.charAt(j)=="@"){ ema++; }
				
				
				}
				
					for (var k=0; k<checkstr.length; k++) {
						if (element_value.charAt(j) == checkstr.charAt(k)) {
							break;
						}
					}
					if (k == checkstr.length) {
						for (var l=0; l<badchars.length; l++) {
							if (element_value.charAt(j) == badchars.charAt(l)) {
								break;
							}
						}

						if (l == badchars.length) {
							badchars += element_value.charAt(j);
						}						allvalid = false;
					}
				}
				
				if (!allvalid) {
					alertstr += "Form element '" + element_name + "' contains the following illegal characters ...\n\t" + badchars + "\n\n";
				}
			}
			if (allvalid) {
				validstr += "Into form element '" + element_name + "' you entered the text ...\n\"" + element_value + "\".\n\n";
			}
		}
		

// Check Textarea boxes ...
		if (element_type == "textarea") {
			//var checkstr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-/*,.'@~#%$��!���(){}[ ]\n\r\f";
			if (element_value.length == 0) {
				alertstr += "Form element '" + element_name + "' contains no data.\n\n";
				allvalid = false;
			} else {
				var badchars = "";
				for (var j=0; j<element_value.length; j++) {
					for (var k=0; k<checkstr.length; k++) {
						if (element_value.charAt(j) == checkstr.charAt(k)) {
							break;
						}
					}
					if (k == checkstr.length) {
						for (var l=0; l<badchars.length; l++) {
							if (element_value.charAt(j) == badchars.charAt(l)) {
								break;
							}
						}

						if (l == badchars.length) {
							badchars += element_value.charAt(j);
						}
						allvalid = false;
					}
				}
				if (!allvalid) {
					alertstr += "Form element '" + element_name + "' contains the following illegal characters ...\n\t" + badchars + "\n\n";
				}
			}
			if (allvalid) {
				validstr += "Into form element '" + element_name + "' you entered the text ...\n\"" + element_value + "\".\n\n";
			}
		}

// Check Drop-down lists ...
		if (element_type.indexOf("select") > -1) {
			var index = theElement.selectedIndex;
			if (index <= 0) {
				alertstr += "The first option in form element '" + element_name + "' is not valid.\n\n";
				allvalid = false;
			}
			if (allvalid) {
				validstr += "From form element '" + element_name + "' you selected option \"" + theElement.options[index].value + "\".\n\n";
			}
		}

// Check Radio buttons ...
		if (element_type == "radio" ) {
			if (theElement.checked == true) {
				radio_selected = true;
				validstr += "From form element '" + element_name + "' you selected the \"" + element_value + "\" button.\n\n";
			}
		}

// Check Checkboxes ...
		if (element_type == "checkbox") {
			if (theElement.checked == true) {
				checkbox_selected = true;
				validstr += "From form element '" + element_name + "' you selected the \"" + element_value + "\" checkbox.\n\n";
			}
		}

// Check Buttons ...
		if (element_type == "button") {
			// Don't check buttons - use the onClick event to invoke functions.
		}

 	// .... End of loop through form elements ....
	}

/*	if (radio_selected == false) {
		alertstr += "There is no Radio Button selected.\n\n";
		allvalid = false;
	} */

/*	if (checkbox_selected == false) {
		alertstr += "There are no Checkboxes selected.\n\n";
		allvalid = false;
	} */

// All elements checked - now determine if form is OK ...
if(ema<1){allvalid = false;}
if(aster>0){allvalid = false;}
	if (allvalid) {
   this.theForm.submit();
		
		return false;
	} else {
		alert ("Please fill all required fields with valid information!");
		return false;
	}
}
//-->



function comonthis(x,y)
{

document.getElementById(x).className=y;

}


function comments(x)
{

var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
 
  xmlHttp.onreadystatechange=function()
    {
    
	if(xmlHttp.readyState==4)
      {

      document.getElementById("com_container_"+x).innerHTML=xmlHttp.responseText;
	  
      }
    }
  var url="index.php/comments";
  url=url+"/?post_id="+x+"&rand="+Math.random()*9999999999999;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);


}

function sent(x)
{
document.getElementById("hid_"+x).innerHTML=document.getElementById("in_"+x).innerHTML;
d="send_another('"+x+"')";
document.getElementById("in_"+x).innerHTML='<div style="width:890px" align="center"><br><br><br>Your form was sent!!<br><a href="javascript:'+d+'">Submit another one!</a></div>';
}

function send_another(x)
{
document.getElementById("in_"+x).innerHTML=document.getElementById("hid_"+x).innerHTML;
document.getElementById("hid_"+x).innerHTML="";
}


function sent_time(x)
{
id=x;
setTimeout("sent(id)",100);
}

function insert_into_comment(x,y)
{
com_sender="com_sender_"+y;
f=x;
id=y;

v="add_comment_"+y;

h=document.getElementById("in_"+v).offsetHeight;
if(document.getElementById(v).style.height!==h+"px")
{
if(document.getElementById("hid_"+v).innerHTML=="")
{
setTimeout("expand_com(v,h)",100);

}
}

if(document.getElementById("hid_"+v).innerHTML!=="")
{
setTimeout("send_another(v)",10);
setTimeout("insert_into_comment(f,id)",200);
}
else
{

if(document.forms[com_sender].comment.value=="Your comment*")
{

document.location="#tcom_"+y;

}

if(document.forms[com_sender].comment.value=="Your comment*")
{
document.forms[com_sender].comment.value="";
}



document.forms[com_sender].comment.value=document.forms[com_sender].comment.value+"{img}"+x+"{/img}";



}
}


function CalcRest(x)
{
	var maxnum;
	var rest;
	var str1;
	maxnum = 500;
	y="com_sender_"+x;
	
	if (document.forms[y].comment.value != null)
	{	str1=document.forms[y].comment.value;
		rest =maxnum - str1.length;
		if (rest < 0 )
		{	document.forms[y].comment.value=str1.substring(0,maxnum);
			rest = 0;
		}
		document.getElementById("rest_"+x).innerHTML=rest;
	}
	return (rest>0)
}

function expand_com (id,h)
{
h=document.getElementById("in_"+id).offsetHeight;
var seg=h/10;

x=id; h=h;
if(document.getElementById(id).style.height!==h+"px")
{

document.getElementById(id).style.position="static";


hh1=seg*0.1; 
setTimeout("expo_com(hh1,x)",30);
hh2=seg*0.4; 
setTimeout("expo_com(hh2,x)",60);
hh3=seg*0.9; 
setTimeout("expo_com(hh3,x)",90);
hh4=seg*1.6; 
setTimeout("expo_com(hh4,x)",120);
hh5=seg*2.5; 
setTimeout("expo_com(hh5,x)",150);
hh6=seg*3.6; 
setTimeout("expo_com(hh6,x)",180);
hh7=seg*4.9; 
setTimeout("expo_com(hh7,x)",210);
hh8=seg*6.4; 
setTimeout("expo_com(hh8,x)",240);
hh9=seg*8.1; 
setTimeout("expo_com(hh9,x)",270);
hh10=seg*10; 
setTimeout("expo_com(hh10,x)",300);
ty=id; cll="fade1";
//setTimeout("chcl(ty,cll)",330);

document.getElementById(id+"_expand_on").className="drop_button_com";
document.getElementById(id+"_expand_off").className="fade1";


}
else
{
h=document.getElementById("in_"+id).offsetHeight;
var seg=h/10;

x=id; h=h;
minimize_com (x,h);
}

}

function expo_com(hh,id)
{
document.getElementById(id).style.height=hh+"px";

}



function minimize_com (id,h)
{
h=document.getElementById("in_"+id).offsetHeight;
var seg=h/10;

x=id; h=h;

hh1=h-seg*1+0; 
setTimeout("expo_com(hh1,x)",30);
hh2=h-seg*2+0; 
setTimeout("expo_com(hh2,x)",60);
hh3=h-seg*3+0; 
setTimeout("expo_com(hh3,x)",90);
hh4=h-seg*4+0; 
setTimeout("expo_com(hh4,x)",120);
hh5=h-seg*5+0; 
setTimeout("expo_com(hh5,x)",150);
hh6=h-seg*6+0; 
setTimeout("expo_com(hh6,x)",180);
hh7=h-seg*7+0; 
setTimeout("expo_com(hh7,x)",210);
hh8=h-seg*8+0; 
setTimeout("expo_com(hh8,x)",240);
hh9=h-seg*9+0; 
setTimeout("expo_com(hh9,x)",270);
hh10=h-seg*10+0; 
setTimeout("expo_com(hh10,x)",300);
document.getElementById(id+"_expand_off").className="drop_button_com";
document.getElementById(id+"_expand_on").className="fade1";
document.getElementById(id).className="dropdown_com";
}


function bt_forcedone() {
	document.getElementById('bt_container').innerHTML = bt_text_finished;
	bt_done();
	}

function bt_arrived(o) {
	bt_loaded += bt_preimages[o][1];
	var bt_percentage = Math.round((bt_loaded/bt_total)*100);
	document.getElementById('bt_container').innerHTML = bt_text_prefix+bt_percentage+'%';
	if(bt_percentage == 100) {
		bt_forcedone();
		}
	}
var bt_total = 0;
var bt_loaded = 0;
var bt_out = '';


if(bt_timeout > 0) {
	setTimeout('bt_forcedone()',bt_timeout*1000);
	}



bt_out += '<div id="bt_container" class="loader"></div>';

for(i = 0; i < bt_preimages.length; i++) {
	bt_total += bt_preimages[i][1];
	bt_out += '<img src="'+bt_preimages[i][0]+'" width="1" height="1" onload="bt_arrived('+i+');" style="position:absolute; top:-5000px;" />';
	}

document.write(bt_out);
