function over(id){
	var box = $(id);
	box.setStyle('border','1px solid #efefef');
	box.setStyle('background','#f5f5f5');
}

function out(id){
	var box = $(id);
	box.setStyle('border','1px solid #fff');
	box.setStyle('background','none');
}

function goEdit(id){
	$('div_'+id+'_normal').setStyle('display','none');
	$('div_'+id+'_edit').setStyle('display','block');
	$(id).focus();
}

function goNormal(id){
	$('div_'+id+'_normal').setStyle('display','block');
	$('div_'+id+'_edit').setStyle('display','none');
	autoSinc(id);
}

function autoSinc(id){
	var html = $(id).value;
	html = html+"";
	html = html.replace(/\n/g,"<br/>");
	$('div_'+id+'_normal').innerHTML = html;
}

function autoHeight(id){
	var the_html	= $(id).value;
	html = the_html.split("");
	var found	= 0;
	var j		= 0;
	for(i=0; i<html.length; i++){
		j++;
		if(html[i]=="\n"||j>115){
			found++;
			j =0;
		}
	}
	var height 	= (found+1)*20;
	if(height < 600){
		$('div_content_normal').setStyle('height','600px');
		$(id).setStyle('height','600px');
	} else {
		$('div_content_normal').setStyle('height',height+"px");
		$(id).setStyle('height',height+"px");
	}
	
}

function setHeaderAlign(val){
	$('div_header_name_normal').setStyle('text-align',val); 
	$('header_name').setStyle('text-align',val); 
	$('div_header_address_normal').setStyle('text-align',val); 
	$('header_address').setStyle('text-align',val); 
}

function createPDF(){
	var fn = function(){
			new Ajax('http://coverletter.bigjobportal.com/coverletter/setsecuritycode.php',{method: 'get', update : $('scode_box')}).request();
		};
	var options = {};
	$('setting').setStyle('display', 'none');
	$('coverLetterMessage').setStyle('display', 'block');
	$('coverLetterMessage').setHTML('<img src="http://coverletter.bigjobportal.com/wp-content/themes/coverletter/images/loading.gif" alt="" /> Please wait .... ');
	options['update'] = 'coverLetterMessage';
	options['onComplete'] = fn;
	options['evalScripts'] = true;
	$('coverLetterForm').send(options);

}
