var isIE = false;

if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
	var ieversion = new Number(RegExp.$1);
	if (ieversion >= 6) isIE = true;
}

function copyData(){
	if (document.getElementById('content_for_user') != null &&
		document.getElementById('content_for_google') != null) {
		var x = document.getElementById('content_for_google').childNodes;
		document.getElementById('content_for_user').innerHTML = '';
		while (x.length>0){
			document.getElementById('content_for_user').appendChild(x[0]);
		}
	}
}

window.onload=function(){
	if (document.getElementById('content_for_google')!=null) {
		copyData();
	}

	if (document.getElementById('menu_image')!=null) {
		document.getElementById('menu_image').onclick=function(){
			window.location='/';
		}
	}

	if (document.getElementById('submit_question_img')!=null) {
		document.getElementById('submit_question_img').onclick=function(){
			document.getElementById('questionlistform').submit();
		}
	}

	if (document.getElementById('iwouldlikeit_form_submit_button')!=null) {
		document.getElementById('iwouldlikeit_form_submit_button').onclick=function(){
			document.getElementById('iwouldlikeit_form').submit();
		}
	}

	if (isIE) {
		var i;
		var iframes = document.getElementsByTagName('iframe');
		for (i=0;i<iframes.length;i++){
			iframes[i].style.cssFloat = 'left';
		}
		for (i=0;i<iframes.length;i++){
			iframes[i].style.cssFloat = '';
		}
	}
	
	var twitter_js = document.createElement('script');
		twitter_js.setAttribute("type","text/javascript");
		twitter_js.setAttribute("src", "http://platform.twitter.com/widgets.js");
		document.getElementsByTagName("head")[0].appendChild(twitter_js);

}
