var month = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
function twitterCallback(obj) {
    var date;
    var str = "";
    var i;
    var values;
    for (i = 0; i < obj.length; i++) {
        //date = new Date(obj[i].created_at);
        //date = new Date('Tue Dec 29 16:23:10 2009');
        values = obj[i].created_at.split(" "); // IE does not handle time zone
        date = new Date(values[0]+" "+values[1]+" "+values[2]+" "+values[3]+" "+values[5]);
        str += "<div class='hw_twitter_article'>"+obj[i].text+"</div>";
        str += "<div class='hw_twitter_date'>"+date.getDate()+" "+month[date.getMonth()];
        str += " "+date.getHours()+":";
        if (date.getMinutes() < 10) {
            str += "0";
        }
        str += date.getMinutes()+" from "+obj[i].source+"</div>";
        if (i < obj.length-1) {
            str += "<img src='/Images/General/Right_menu/rm_twitter_dashedlines.png'>";
        }
    }
    document.getElementById('twitter').innerHTML = str;
}
function openWebClient() {
	var s = s_gi('sonyericssoncomuserprod');
	s.linkTrackVars = 'prop6';
	s.prop6 = 'hanashi : main : webclient : global_en';
	s.tl(true,'o', 'hanashi : main : webclient : global_en');

	window.open( "WebClient/war?debug=1", "_blank", "height=540,width=333,directories=no,location=no,menubar=no,resizable=yes,resize=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no" );
    return false;
}
function openYouTube() {
	var s = s_gi('sonyericssoncomuserprod');
	s.linkTrackVars = 'prop6';
	s.prop6 = 'hanashi : main : youtube : global_en';
	s.tl(true,'o', 'hanashi : main : youtube : global_en');

	window.open( "/youtube.html", "_blank", "height=440,width=690,directories=no,location=no,menubar=no,resizable=yes,resize=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no" );
    return false;
}


function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}

function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
}

function popup(windowname) {
	blanket_size(windowname);
	toggle('blanket');
	toggle(windowname);
}

function stopTheVideo() {
	var myPlayer = document.getElementById('playerid');
	if (myPlayer != undefined && myPlayer.stopVideo != undefined) {
		myPlayer.stopVideo();
	}
}
