

/* Header Functions */

	/* Interactive Form Elements */

	function clean_fill(id,choice,text)
	{
		
		switch(choice)
		{
			case 1:
			{
				
				if(document.getElementById(id).value == text)
				{
					
					document.getElementById(id).value='';
					
				}
				
			break;
			
			}
			
			case 2:
			{
				
				if(document.getElementById(id).value == '')
				{
					
					document.getElementById(id).value=text;
					
				}
				
			break;
			
			}
		}
	}
	
	/* Interactive Form Elements End */
	
	/* Hover Icon Change */
	
	function iconchange(name,tail,root)
	{

		document.getElementById(name).src =  root + '/images/icon_'+name+tail+'.gif';
		
	}
	
	/* Hover Icon Change End */
	
	function getHTTPObject()
	{   
	
		if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
		else 
		if(window.XMLHttpRequest) return new XMLHttpRequest();  		
		else {alert("Explorer AJAX Desteklemiyor."); return null;   
		
	}
	}    
	
	
	function control_send(box)
	{
		if(box.checked == true)
		{
			
//			alert(code);
			
//			if(document.getElementById('sg_guvenlik').value == code)
//			{
				
			document.getElementById('form').submit();
				
//			}
//  		else
//			{
//				
//				document.getElementById('imp').innerHTML="Güvenlik Karakterlerini Doğru Giriniz";
//				
//			}
//			
		}
		else
		{
			
			document.getElementById('imp').innerHTML="Sözleşmeyi Kabul Etmelisiniz";
			
		}
		
	}
	
	function membership_contract(root)
	{
		
		var left = (screen.width- 800) / 2;
		var top  = (screen.height - 600) / 2;

		window.open(root+"membership_contract.html",null,"top="+top+",left="+left+",height=600px,width=800px,status=no,toolbar=no,menubar=no,location=0,directories=no,resizable=no",0);
	
	}
	
	function see_privacy(root)
	{
		
		var left = (screen.width- 800) / 2;
		var top  = (screen.height - 600) / 2;

		window.open(root+"privacy.html",null,"top="+top+",left="+left+",height=600px,width=800px,status=no,toolbar=no,menubar=no,location=0,directories=no,resizable=no",0);
	
	}

/* Header Functions End */



/* Main Page Functions */

	/* Change Main Page Tabs */
	
	function changeDiv(id)
	{
		if(id == 1)
		{
			
			old_div_id = 2;
			
		}
		else
		{
			
			old_div_id = 1;
			
		}

		document.getElementById('div' + old_div_id).style.display = 'none';
		document.getElementById('div' + id).style.display = '';
		document.getElementById('title_div' + old_div_id).className = 'passive_tab';
		document.getElementById('title_div' + id).className = 'active_tab';
		old_div_id = id;
		
	}
	
	/* Change Main Page Tabs End */
	
/* Main Page Functions End */

/* Complaint List Page Functions */

	/* Open And Close Firm Categories */

	function open_close_firm_category_tab(id)
	{

		if(document.getElementById(id).style.display == '')
		{
		
			document.getElementById(id).style.display = 'none';
			
		}
		else if(document.getElementById(id).style.display == 'none')
		{
		
			document.getElementById(id).style.display = '';
			
		}

		
	}

	/* Open And Close Firm Categories End */
		
/* Complaint List Page Functions End */


/* Complaint Details Page Functions */

	function print_complaint(root,id)
	{

			window.open(root+"print.html/"+id+"/");
	}
	
	function send_to_friend(root,address)
	{
		
		var left = (screen.width- 500) / 2;
		var top  = (screen.height - 450) / 2;

		window.open(root+"arkadasima-gonder.php?link="+address,null,"top="+top+",left="+left+",height=275px,width=370,status=no,toolbar=no,menubar=no,location=0,directories=no,resizable=no",0);
	
	}
	
	function send_comment()
	{
		
		var asd =  document.getElementById("yorumyazmaalani");	
		httpObject = getHTTPObject();
		
		if (httpObject != null)
		{        
    
			httpObject.open("POST","functions/java/add_comment.php",true); //calling testing.php using POST method
			httpObject.send("comment=" + asd.value); //Posting txtname to PHP File		 	
			httpObject.onreadystatechange = handleServerResponse;   
		
		}
		
	}
	 
	function handleServerResponse()
	{

	   if (httpObject.readyState == 4)
	   {
	   
		 if(httpObject.status == 200)
		 {
			 
				if(httpObject.responseText == '1')
				{
					
					var sURL = unescape(window.location.pathname);
					window.location.href = sURL;
					
				}
				
				
		 }
		 else
		 {
		 
			alert("Error during AJAX call. Please try again");
		
		 }
	   }
	   
	}	
/* Complaint Details Page Functions End */

function custom_control()
{
	if(document.getElementById('sg_kategori').value == "0")
	{
		document.getElementById('custom_firm_row').style.display = '';
	}
	else
	{
		document.getElementById('custom_firm_row').style.display = 'none';
	}
	
}

function choose_firm(id)
{

	document.getElementById('sg_kategori').value = id;
}
