function open_win(url,name,valuewidth,valueheight) {
	var remote = window.open(url, name, "toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=1,scrollbar=yes,width="+valuewidth+",height="+valueheight+",left=70,top=95");
	if(!remote)
	{
		return remote;
	}
	else if (remote.opener == null) // if something went wrong
	{ 
		remote.opener = window;
		remote.opener.name = orgName;
		return remote; 
	}
	else
	{
		return remote;
	}
}

function confact(prname,prgoto){
	Check = confirm("Do you really want to delete \""+prname+"\"?");
	if(Check == true){
		window.location.href = prgoto;
	}
	;
}

function confpay(prname,prgoto){
	Check = confirm("Did the participant \""+prname+"\" pay the charge?");
	if(Check == true){
		window.location.href = prgoto;
	}
	;
}

function show_tip(tipid) {
	document.getElementById(tipid).style.visibility = "visible";
};
function hide_tip(tipid) {
	document.getElementById(tipid).style.visibility = "hidden";
};

function cenom(cenomid)
{
	for (var j = 0; j < 500; j++) {
		if(document.getElementById('cenom'+j))
		document.getElementById('cenom'+j).style.display = 'none';
	}
	document.getElementById('cenom'+cenomid).style.display = 'block';
}

function request_show(reid,srv_address)
{
	if(document.getElementById('re_'+reid).style.display == 'none')
	{
		document.getElementById('re_'+reid).style.display = 'block';
		document.getElementById('img'+reid).src = srv_address+'i/but_minus.gif';
	}
	else
	{
		document.getElementById('re_'+reid).style.display = 'none';
		document.getElementById('img'+reid).src = srv_address+'i/but_plus.gif';
	}
	return false;
}


function cenom_link(cenomid, changeclass)
{
	// for (var j = 0; j < 500; j++) {
	// if(document.getElementById('cenom'+j))
	// document.getElementById('cenom'+j).style.display = 'none';
	// }
	if(document.getElementById('cenom'+cenomid).style.display == 'block')
	{
		document.getElementById('cenom'+cenomid).style.display = 'none';
		if(changeclass != "false")
		{
			document.getElementById('cenom_link'+cenomid).className = 'cenom_link_ad';
		}
	}
	else
	{
		document.getElementById('cenom'+cenomid).style.display = 'block';
		if(changeclass != "false")
		{
			document.getElementById('cenom_link'+cenomid).className = 'cenom_link_sub';
		}
	}
}

function submit_absent_time(profile_pers_id,sub_address)
{
	var absent_time_from = document.getElementById('time_fr_hour').value+":"+document.getElementById('time_fr_min').value;
	var absent_date_from = document.getElementById('atdate').value;
	var absent_datetime_from = absent_date_from+"x"+absent_time_from;
	var absent_datetime_from_text = absent_date_from+" "+absent_time_from;

	var absent_time_to = document.getElementById('time_to_hour').value+":"+document.getElementById('time_to_min').value;
	var absent_date_to = document.getElementById('atdate').value;

	var absent_datetime_to = absent_date_to+"x"+absent_time_to;
	
	var absent_date = absent_datetime_from+"xx"+absent_datetime_to;
	var absent_date_text = absent_datetime_from_text+" - "+absent_time_to;
	
	new_option = new Option(absent_date_text, absent_date, false, false);
	
	document.getElementById('absent_time').options[document.getElementById('absent_time').length] = new_option;
	
	document.getElementById('absent_time_submitter').src=sub_address+"?"+absent_date+"&id="+profile_pers_id;
}

function delete_absent_time(profile_pers_id,sub_address)
{
	var delete_absent_times = "";
	for(var i=0;i < document.getElementById('absent_time').length;i++)
	{
		if(document.getElementById('absent_time').options[i].selected)
		{
			delete_absent_times += "delete_absent_time[]="+document.getElementById('absent_time').options[i].value+"&";
			document.getElementById('absent_time').options[i] = null;
			i=-1;
		}
	}
	document.getElementById('absent_time_submitter').src=sub_address+"?id="+profile_pers_id+"&"+delete_absent_times;
}

function haw_asia_day(rb)
{
	if(rb.value=="yes")
	{
		/* confirm(document.getElementById('asia_day0').value); */
		open_win('help.php?t=1','asia_day_pu','400','200');
		document.getElementById('session[3]').checked=true;
	}
}

// B2BMap
function b2bmap_over (sdaf)
{
	divs = sdaf.getElementsByTagName('div');
	divs[4].className='div_man_over_comp_name';
	sdaf.className='div_man_over'
}
function b2bmap_out (sdaf)
{
	sdaf.className='div_man_out'

	divs = sdaf.getElementsByTagName('div');
	divs[4].className='div_man_out_comp_name';
}


var req = null;

function ajax_request2(url,http_request_send,dowhat)
{
	try{
		req = new XMLHttpRequest();
	}
	
    catch (ms){
    	try{
        	req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
        catch (nonms){
        	try{
            	req = new ActiveXObject("Microsoft.XMLHTTP");
			} 
            catch (failed){
            	req = null;
			}
		}  
	}

	if (req == null)
		alert("Error creating request object!");
                  
	//anfrage erstellen (POST, url ,
	//request ist asynchron      
	req.open("POST", url, true);

	//Beim abschliessen des request wird diese Funktion ausgeführt
	req.onreadystatechange = function(){            
	switch(req.readyState) {
    	case 4:
			if(req.status!=200) {
				alert("Fehler:"+req.status); 
			}else{    
				if(typeof dowhat == 'function') dowhat()
			}
            break;
                    
            default:
            	return false;
			break;     
		}
	};
  
	req.setRequestHeader("Content-Type",
		"application/x-www-form-urlencoded");
	req.send(http_request_send);
}

function comp_show(co_id,uri_str)
{
	if(document.getElementById('comp_child'+co_id).style.display == 'none')
	{
		var url = 'ajax/val_profile_comp_child.php';
		var http_request_send = 'comp_id='+co_id+'&'+uri_str;
		var return_function = function(){
			document.getElementById('comp_child'+co_id).innerHTML = req.responseText;
			document.getElementById('comp_child'+co_id).style.display = 'block';
			document.getElementById('coimg'+co_id).src = 'i/but_minus.gif';
		}
		;	
		ajax_request2(url,http_request_send,return_function);
	}
	else
	{
		document.getElementById('comp_child'+co_id).style.display = 'none';
		document.getElementById('coimg'+co_id).src = 'i/but_plus.gif';
	}
	return false;
}

function val_profile_all(id,status_to)
{
	var url = 'ajax/val_profile.php';
	var http_request_send = 'profile_type=all&id='+id+'&status_to='+status_to;
	var return_function = function(){
		xmldoc = req.responseXML;
		
		var root_node = xmldoc.getElementsByTagName('company').item(0);
		var alllinks = xmldoc.getElementsByTagName('alllinks');
		var status_to = xmldoc.getElementsByTagName('status');
		var techids = xmldoc.getElementsByTagName('techid');
		var persids = xmldoc.getElementsByTagName('persid');
		
		
		if(document.getElementById('comp_val'+id))
		{
			document.getElementById('comp_val'+id).innerHTML=status_to[0].firstChild.data;
		}
		all_val = document.getElementById('all_val'+id)
		if(all_val)
		{
			all_val.innerHTML = alllinks[0].firstChild.data;
		}
		// alert(status_to[0].firstChild.data);
		for(i = 0; i < techids.length;i++)
		{
			techid = techids[i].firstChild.data;
			if(document.getElementById('tech_val'+techid))
			{
				document.getElementById('tech_val'+techid).innerHTML=status_to[0].firstChild.data;
			}
		}
		for(i = 0; i < persids.length;i++)
		{
			persid = persids[i].firstChild.data;
			if(document.getElementById('pers_val'+persid))
			{
				document.getElementById('pers_val'+persid).innerHTML=status_to[0].firstChild.data;
			}
		}
		
	};
	
	ajax_request2(url,http_request_send,return_function);

	return false;
}

function val_profile(profile_type,id)
{
	var url = 'ajax/val_profile.php';
	var http_request_send = 'profile_type='+profile_type+'&id='+id;

	var return_function = function(){
		document.getElementById(profile_type+'_val'+id).innerHTML = req.responseText;
	};
	
	ajax_request2(url,http_request_send,return_function);
	
	return false;
}

function shown_up(shown_up,id)
{
	var url = 'ajax/val_shown_up.php';
	var http_request_send = 'shown_up='+shown_up+'&id='+id;

	var return_function = function(){
		document.getElementById('shown_up'+id).innerHTML += req.responseText;
	};
	ajax_request2(url,http_request_send,return_function);

	return false;
}

function reset_sms(uID)
{
	var url = 'ajax/val_reset_sms.php';
	var http_request_send = 'uID='+uID;

	var return_function = function(){
		document.getElementById('reset_sms'+uID).innerHTML = req.responseText;	
	};
	ajax_request2(url,http_request_send,return_function);

	return false;
}

var cur_key = 0;
function getKeyCode(event) {
		//cur_key = event.keyCode;
	}
document.onkeydown = getKeyCode;

// Form Validation:
function validate_form(id,mandatory,description,validemail,emailexists,mustequal,defaultvalue)
{
	if(mandatory == 1)
	{
		if(trim(document.getElementById(id).value) == "" || document.getElementById(id).value == defaultvalue)
		{
			document.getElementById(id+'span').style.display='block';
		}
		else
		{
			document.getElementById(id+'span').style.display='none';
		}
	}
	if(validemail == 1)
	{
		var emailaddress = trim(document.getElementById(id).value);
		if (!emailaddress.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i))
		{
    		document.getElementById(id+'spanemail').style.display='block';
		}
		else
		{
			document.getElementById(id+'spanemail').style.display='none';
		}
	}
	if(emailexists == 1)
	{
		var email = trim(document.getElementById(id).value);
		validate_form_emailexists(email,id)
		if(validate_form_emailexists(email,id))
		{
		}
		else
		{
		}
	}
	if(mustequal.length > 0)
	{
		if(document.getElementById(id).value != document.getElementById(mustequal).value)
		{
			document.getElementById(id+'spanequals').style.display='block';
		}
		else
		{
			document.getElementById(id+'spanequals').style.display='none';
		}
	}
}

// E-Mail exists validation
function validate_form_emailexists(email,id)
{
	var url = 'ajax/already_registered.php';
	var http_request_send = 'email='+email;
	var return_function = function(){
		var xmldoc = req.responseXML;
		var root_node = xmldoc.getElementsByTagName('root').item(0);
        if(root_node.firstChild.data == 1)
        {
			document.getElementById(id+'spanemailex').style.display='block';
			document.getElementById(id+'spanemailexvalue').firstChild.data=email;
		}
        else
        {
			document.getElementById(id+'spanemailex').style.display='none';
        }
	};
	
	ajax_request2(url,http_request_send,return_function);
}

// Help
function help_show(id)
{
	var url = 'ajax/help_show.php';
	var http_request_send = 'help_id='+id+'&';
	var return_function = function(){
		document.getElementById('help_show'+id).style.display = "block";
		document.getElementById('help_show'+id).innerHTML = req.responseText;	
	};
	
	ajax_request2(url,http_request_send,return_function);
}

function help_hide(id)
{
	document.getElementById('help_show'+id).style.display = "none";
}

// Comments
function show_comments_sw(comment_id,comment_type,sw)
{
	document.getElementById(comment_type+comment_id+'comments').style.display = sw;
}

function show_comments(comment_id,comment_type)
{
	var url = 'ajax/comments.php';
	var http_request_send = 'comment_id='+comment_id+'&'+'comment_type='+comment_type+'&';
	var return_function = function(){
    	document.getElementById(comment_type+comment_id+'comments').style.display = "block";
		document.getElementById(comment_type+comment_id+'comments').innerHTML = req.responseText;		
	};
	
	ajax_request2(url,http_request_send,return_function);
}

// Weiterempfehlen
function show_recommend()
{
	if(document.getElementById('b2bm-recommend2').style.display == "block")
	{
    	document.getElementById('b2bm-recommend2').style.display = "none";
	}
	else
	{
		var url = 'ajax/recommend.php';
		var http_request_send = '';
		var return_function = function(){
	    	document.getElementById('b2bm-recommend2').style.display = "block";
			document.getElementById('b2bm-recommend2').innerHTML = req.responseText;
		};
		
		ajax_request2(url,http_request_send,return_function);
	}	
}

function tell_a_friend()
{
	mail_to_name = escape(document.getElementsByName("tell_a_friend_mail_to_name")[0].value);
	mail_to_email = escape(document.getElementsByName("tell_a_friend_mail_to_email")[0].value);
	mail_to_comment = escape(document.getElementsByName("tell_a_friend_mail_comment")[0].value);

	if(!mail_to_email.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i))
	{
		alert("Bitte geben Sie eine E-Mail Adresse an!");
		return false;
	}
	
	var url = 'ajax/recommend_tell_a_friend.php';
	var http_request_send = 'params[mail_to_name]='+mail_to_name
	+'&params[mail_to_email]='+mail_to_email+'&'
	+'params[mail_to_comment]='+mail_to_comment;
	
	var return_function = function(){
		alert("Ihre Einladung wurde verschickt");

		document.getElementsByName("tell_a_friend_mail_to_name")[0].value = '';
		document.getElementsByName("tell_a_friend_mail_to_email")[0].value = '';		
	};
	
	ajax_request2(url,http_request_send,return_function);
}

// Request Stats
function req_stats_sw(req_id,req_type,req_status,sw)
{
	document.getElementById('stat'+req_id+req_type+req_status).style.display = sw;
}
var req_stats_over_current=false;
function req_stats(event_id,req_id,req_type,req_status)
{
	if(req_stats_over_current)
	{
		document.getElementById(req_stats_over_current).style.display = "none";
	}
	req_stats_over_current='stat'+req_id+req_type+req_status;
	document.getElementById(req_stats_over_current).innerHTML='';
    document.getElementById(req_stats_over_current).className='';
    document.getElementById(req_stats_over_current).style.display = "block";
    
	var url = 'ajax/request_stats_details.php';
	var http_request_send = 'params[event_id]='+event_id+'&req_id='+req_id+'&'+'req_type='+req_type+'&'+'req_status='+req_status;
	var return_function = function(){
		if(req.responseText)
		{
			document.getElementById(req_stats_over_current).className='req_stats_details';
			document.getElementById(req_stats_over_current).innerHTML = req.responseText;
		}
		else
		{
			document.getElementById(req_stats_over_current).style.display = "none";
		}
	};
	
	ajax_request2(url,http_request_send,return_function);	
}

// Tech Info
function tech_info_sw(ptppdem_id,sw)
{
	document.getElementById('comp'+ptppdem_id).style.display = sw;
}
function tech_info(ptppdem_id)
{	
	if(req_stats_over_current)
	{
		document.getElementById(req_stats_over_current).style.display = "none";
	}
	req_stats_over_current = 'comp'+ptppdem_id;
	document.getElementById(req_stats_over_current).innerHTML='';
    document.getElementById(req_stats_over_current).className='';
    document.getElementById(req_stats_over_current).style.display = "block";
	
	var url = 'ajax/request_stats_tech_info.php';
	var http_request_send = 'ptppdem_id='+ptppdem_id;
	var return_function = function(){
		if(req.responseText)
		{
			document.getElementById(req_stats_over_current).className='req_stats_details';
	        document.getElementById(req_stats_over_current).innerHTML = req.responseText;
		}
		else
		{
			document.getElementById(req_stats_over_current).style.display = "none";
		}	
	};
	
	ajax_request2(url,http_request_send,return_function);
}

// TTM Highlight
function ttm_highlight(event_id,tech_id,comp_id,pers_id,pending,color)
{
	var url = 'ajax/ttm_highlight.php';
	var http_request_send = 'event_id='+event_id+'&tech_id='+tech_id+'&'+'comp_id='+comp_id+'&'+'pers_id='+pers_id+'&'+'pending='+pending;
	var return_function = function(){
		var root_node = req.responseXML.getElementsByTagName('highlights').item(0);
		var fieldids = req.responseXML.getElementsByTagName('fieldid');
			
		for(i = 0; i < fieldids.length;i++)
		{
			document.getElementById(fieldids[i].firstChild.data).style.backgroundColor=color;
		}
	};
	
	ajax_request2(url,http_request_send,return_function);
	return false;
}

// Save Page
function save_page(filename)
{
	var http_request_send = 'params[file]='+filename+'&'
	
	textareas = document.getElementsByTagName('textarea')
	for(x=0;x<textareas.length;x++)
	{
		http_request_send += textareas[x].name+'='+escape(tinyMCE.get(textareas[x].name).getContent())+'&' 
	}
	// alert(http_request_send);return false;
	inputs = document.getElementsByTagName('input')
	for(x=0;x<inputs.length;x++)
	{
		if((inputs[x].name != 'page_menu' && inputs[x].name != 'page_lang[]') || inputs[x].checked)
		{
			http_request_send += inputs[x].name+'='+encodeURI(inputs[x].value).split('&').join('%26')+'&'
		}
	}
	
	var url = 'ajax/adm_pages_save_page.php';
	var return_function = function(){
		document.getElementById('adm_pages_ajax_reply').style.display = "block";
        document.getElementById('adm_pages_ajax_reply').innerHTML = req.responseText;		
	};
	
	ajax_request2(url,http_request_send,return_function);
	
	return false;
}

// Delete image
function delete_image(key,name,id)
{
	var url = 'ajax/delete_image.php';
	var http_request_send = 'params[key]='+key+'&params[name]='+name+'&params[id]='+id;
	var return_function = function(){
        document.getElementById('img_'+name+'_container').style.display = "none";		
	};
	
	ajax_request2(url,http_request_send,return_function);
	
	return false;
}

// Message
function send_message_window(message_to,pm_id,subject)
{
	show_overlay();
	
	var url = 'ajax/meet_contacts_message.php';
	pm_id = pm_id?pm_id:message_to;
	var http_request_send = 'action=form&params[message_to]='+message_to+'&params[pm_id]='+pm_id+'&params[subject]='+escape(subject)+'&';
	var return_function = function(){
		document.body.innerHTML += req.responseText;
		contact_pm = document.getElementById('contact_pm'+pm_id);
		viewp = new Viewport();
		pos_left = ((viewp.windowX-450)/2)
		pos_top = ((viewp.windowY-230)/2)+viewp.scrollY;
		contact_pm.style.left=pos_left+'px';
		contact_pm.style.top=pos_top+'px';		
	};
		
	ajax_request2(url,http_request_send,return_function);
	
	return false;
}

function send_message_window_close(pm_id)
{
	var d = document.getElementById('contact_pm'+pm_id); 
	document.body.removeChild(d);
	hide_overlay();
}
	
function send_message_send(message_to,pm_id)
{
	var url = 'ajax/meet_contacts_message.php';
	pm_id = pm_id?pm_id:message_to;
	pm_subject = escape(document.getElementsByName('pm_subject'+pm_id)[0].value);
	pm_message = escape(document.getElementsByName('pm_message'+pm_id)[0].value);
	var http_request_send = 'params[message_to]='+message_to+'&params[pm_subject]='+pm_subject+'&'+'params[pm_message]='+pm_message+'&';
	var return_function = function(){
		if(req.responseText)
		{
			alert(req.responseText);
		}
		else
		{
			send_message_window_close(pm_id);
		}		
	};
		
	ajax_request2(url,http_request_send,return_function);		
	
	return false;
}

// Contacts
function add_to_contacts_window(contact_id)
{
	show_overlay();
	
	var url = 'ajax/meet_contacts.php';
	var http_request_send = 'action=add_form&params[contact_id]='+contact_id+'&';
	var return_function = function(){
		if(req.responseText)
		{	
			document.body.innerHTML += req.responseText;
			contact_pm = document.getElementById('contact_add'+contact_id);
			viewp = new Viewport();
			pos_left = ((viewp.windowX-450)/2)
			pos_top = ((viewp.windowY-230)/2)+viewp.scrollY;
			contact_pm.style.left=pos_left+'px';
			contact_pm.style.top=pos_top+'px';
		}
		else
		{
			hide_overlay();
		}
	};
		
	ajax_request2(url,http_request_send,return_function);	

	return false;
}

function add_to_contacts_window_close(contact_id)
{
	var d = document.getElementById('contact_add'+contact_id); 
	document.body.removeChild(d);
	hide_overlay();
}

function contacts_add_send(contact_id)
{
	var url = 'ajax/meet_contacts.php';
	contact_message = escape(document.getElementsByName('contact_message'+contact_id)[0].value);
	var http_request_send = 'action=add&params[contact_id]='+contact_id+'&params[contact_message]='+contact_message+'&';
	var return_function = function(){
		if(req.responseText)
		{
			alert(req.responseText);
		}
		else
		{
			add_to_contacts_window_close(contact_id);
		}	
	};
		
	ajax_request2(url,http_request_send,return_function);
	
	return false;
}

function accept_contact(contact_id)
{
	var url = 'ajax/meet_contacts.php';
	var http_request_send = 'action=accept_contact&params[contact_id]='+contact_id;
	var return_function = function(){
		if(req.responseText)
		{
			alert(req.responseText);
		}
					
		document.getElementById('contact'+contact_id).style.display='none';	
	};
		
	ajax_request2(url,http_request_send,return_function);
	
	return false;
}

// AJAX Request
var http_request = false;
function ajax_request(url,http_request_send,return_type)
{
	http_request = false;
	this.return_type = return_type;
	// document.getElementById('ajax_loading').style.display='block';
	
	if (window.XMLHttpRequest) 
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) 
		{
			http_request.overrideMimeType('text/xml');
		}
	}
	else if (window.ActiveXObject) 
	{ // IE
		try 
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) 
		{
			try 
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e) {}
		}
	}

	if (!http_request) 
	{
            return false;
	}
	
	// http_request.onreadystatechange = ajax_request_hide;
	// http_request.open('POST', url, true);
	
	http_request.open('POST', url, false);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send(http_request_send);

	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			if(this.return_type=='text' && http_request.responseText)
        	{
        		return http_request.responseText;        		
        	}
        	else if(this.return_type=='xml' && http_request.responseXML)
        	{
        		/* XML */
        		var xmldoc = http_request.responseXML;
        		return xmldoc;
        	}
		}
    }	
}

function show_overlay()
{
	body_size = getPageSizeWithScroll();
	var overlay = document.getElementById('overlay');
	overlay.style.display='block';
	overlay.style.height=body_size[1]+"px";
}
function hide_overlay()
{
	var overlay = document.getElementById('overlay');
	overlay.style.display='none';
}

function Viewport(){ 
	this.windowX = (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth	|| document.body.clientWidth; 
	this.windowY = (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight; 
	this.scrollX = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft; 
	this.scrollY = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop; 
	this.pageX = (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth; 
	this.pageY = (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight;
}

function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}


/* FUNCTIONS */
// Trim
function trim(s) 
{
  while (s.substring(0,1) == ' ') 
  {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') 
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}

// str_replace
function str_replace(search, replace, subject) 
{
    return subject.split(search).join(replace);
}

// explode
function explode(needle,haystack)
{
	return haystack.split(needle);
}
