function toggle_div(obj, togg){
   if(document.getElementById){
	   var el = document.getElementById(obj);   
	   if(togg == 'toggle'){
		  if(el.style.display != "block"){      
			 el.style.display = "block";
		  }else{
			 el.style.display = "none";
		  } 
	   }
	   
	   if(togg == 'hide'){
		  el.style.display = "none";
	   }
	   
	   if(togg == 'show'){
		  el.style.display = "block";      
	   }
   }
   
}

function confirmation_url(Txt, url) {
	var answer = confirm(Txt)
	if (answer){
		goto(url);
	}
}

function confirmation_(Txt, area_b, container_c, get_d) {
	var answer = confirm(Txt)
	if (answer){
		account_checker(area_b, container_c, get_d);
		toggle_div(container_c, 'hide');
		
		if(area_b == 'link_content_delete')postednum('postednum');
	}
}

function confirmation(Txt,  area_b, container_c, get_d) {
	var answer = confirm(Txt)
	if (answer){
		account_checker(area_b, container_c, get_d);
	}
}

function goto(url){
	window.location.href = url;
}

function forceField(obj, val){
	document.getElementById(obj).value = val;
}

function donothing(){
	
}

function redirect(url, seconds){
	setTimeout("window.location='"+url+"'",seconds*1000);
}

function objv(objName){
	return '&'+objName+'='+document.getElementById(objName).value+'';	
}

function writeHtml(objName, value){	
	return document.getElementById(objName).innerHTML=value;
}

function postednum(objName){	
	var currnum;
	var value;
	currnum = document.getElementById(objName).innerHTML;
	
	value = parseInt(currnum) - 1;
	writeHtml(objName, value);
}



var divIDString;
var sid_a1;
var get_d1;
var area_b1;


function account_checker(area_b, container_c, get_d){ 
	divIDString = container_c;
	area_b1 = area_b;
	sid_a1 = document.getElementById('addsID').value;
	get_d1 = get_d;
	//alert(str_d);
	xmlHttp=GetXmlHttpObject_2();
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
 	}
	
	
	var url="link_output.php";
	var get_da = get_d.replace(/\n/g, '<br>')
	url=url+"?area="+area_b+get_da+"&addsID="+sid_a1;	
	//alert(url);
	url=url+"&sid="+Math.random();	
	xmlHttp.onreadystatechange=stateChangedDiv;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//AJAX Get Start----------------------------------------------------------------
function stateChangedDiv() { 
	if (xmlHttp.readyState==0){
   		alert('The request is not initialized')
    } 
	if (xmlHttp.readyState==1){	
   	//	document.getElementById(divIDString).innerHTML='<div class="preloader_area">The request has been set up</div>';
    } 
	if (xmlHttp.readyState==2){
   	//	document.getElementById(divIDString).innerHTML='<div class="preloader_area">The request has been sent</div>';
    } 
	if (xmlHttp.readyState==3){
   		//document.getElementById(divIDString).innerHTML='<div class="preloader_area">Loading please wait...</div>';
    } 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){	
		var responceOUt = document.getElementById(divIDString);
		responceOUt.innerHTML=xmlHttp.responseText;	
		
    } 
	
}

function GetXmlHttpObject_2()
{
	var xmlHttp=null;
	try{
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
 		}
	catch (e){
    //Internet Explorer
 		try{
  			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 	catch (e){
    	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
 	 	}
 	}
return xmlHttp;
}




function checkifvalid_basic(){
		
	if (window.document.basic_account.customers_email_address.value==""){
		alert("Error on email address!");
		window.document.basic_account.customers_email_address.focus();
		return false;
	}	
	if (window.document.basic_account.customers_nick.value==""){
		alert("Please enter your Nickname!");
		window.document.basic_account.customers_nick.focus();
		return false;
	}
	if (window.document.basic_account.customers_firstname.value==""){
		alert("Please enter your Firstname!");
		window.document.basic_account.customers_firstname.focus();
		return false;
	}
	if (window.document.basic_account.customers_lastname.value==""){
		alert("Please enter your Lastname!");
		window.document.basic_account.customers_lastname.focus();
		return false;
	}
	
	if (window.document.basic_account.customers_password_check.checked){	
		if (window.document.basic_account.customers_password.value==""){
			alert("Error on password!");
			window.document.basic_account.customers_password.focus();
			return false;
		}
	}	
	
	if (window.document.basic_account.entry_country_id.value==""){
		alert("Please select your country!");
		window.document.basic_account.entry_country_id.focus();
		return false;
	}	
	if (window.document.basic_account.entry_city.value==""){
		alert("Please enter your city!");
		window.document.basic_account.entry_city.focus();
		return false;
	}	
}

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function rowOverEffect2(object) {
  if (object.className == 'moduleRow2') object.className = 'moduleRowOver2';
}

function rowOutEffect2(object) {
  if (object.className == 'moduleRowOver2') object.className = 'moduleRow2';
}




function popupWindowForgot(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=450,height=20,screenX=150,screenY=150,top=150,left=150')
}

