jQuery(function($){
$('#mainSearch')
    .focus(function(e){ if (this.value == 'Search') this.value = '' })
    .blur(function(e){ if (this.value == '') this.value = 'Search' });
});

function toggleDiv(div) {
	if(document.getElementById(div).style.display=='block') {
		document.getElementById(div).style.display='none';
	}
	else {
		document.getElementById(div).style.display='block';
	}
}


$(document).ready(function(){
   
   $("#twitterb").click(function () {
     $("#twitter").toggle("slow");
   });    

 });

function togglePlatform(id) {
	v=document.getElementById('a'+id).value;
	if(v==1) {
		document.getElementById('a'+id).value=0;
		document.getElementById('t'+id).style.fontWeight='normal';
		document.getElementById('t'+id).style.color='#999999';		
	}
	if(v==0) {
		document.getElementById('a'+id).value=1;
		document.getElementById('t'+id).style.fontWeight='bold';
		document.getElementById('t'+id).style.color='#000000';
	}	
}

function changePerPage(ordertag, urlpage, stakeholder, own, other) {
	selectObj=document.getElementById('selectperpage');
	var idx = selectObj.selectedIndex; 
 	var which = selectObj.options[idx].value;
	document.location='/discussion/'+ordertag+'/'+urlpage+'/'+which+'/'+stakeholder+'/'+own+'/'+other;	
}

function updateHidden(selectObj, where) {
	var idx = selectObj.selectedIndex; 
 	var which = selectObj.options[idx].value;
		
	document.getElementById(where).value=which;
}

function transformPromoBox() {
	if(document.getElementById('promobox').value=='Click to enter your code') {
		document.getElementById('promobox').value='';
		document.getElementById('promobox').className='promobox-clicked';
		box=document.getElementById('promobox');
		box.setAttribute('maxlength', 6);		
	}
}

function checkPromoBox() {
	string=document.getElementById('promobox').value;
	if(string.length==6) {
		document.location='http://www.socialbusiness.be/c/'+string;
	}

}
