/*
* GENERAL FUNCTIONS
* 
* Window and screen handling functions
*
*/






/**************************************** Window and screen handling functions ***************************************************/


//page global variables
var window_width, window_height, screen_width, screen_height, avail_width, avail_height;

var pop_win_ref;

//function to get page dimensions
function getPageDimensions() 
{
	window_width = (is_ie) ? document.body.clientWidth : window.innerWidth;
	window_height = (is_ie) ? document.body.clientHeight : window.innerHeight;
	
	avail_width = screen.availWidth;
	avail_height = screen.availHeight;
	
	screen_width = screen.width;
	screen_height = screen.height;
}


//function get xy (returns string for pop up properties
function getWinXY (win_width,win_height) 
{		
	//get page dimensions if not already set
	if (screen_width == null) getPageDimensions();
	
	//determine x y of centered window
	var xpos = Math.round(((avail_width - win_width)/2));
	var ypos = Math.round(((avail_height - win_height)/2)) - ((screen_height - avail_height)/2);	
	
	//start return string
	var return_string = 'width='+win_width+',height=' + win_height;
	
	//return relevant string
	if (is_nav && (is_major <=4)) return (return_string + ',screenX=' + xpos + ',screenY=' + ypos)
	else return (return_string + ',left=' + xpos + ',top=' + ypos)
}



//futura general popup function (centres on page)
function popWin (file_name,win_name,win_width,win_height,is_scroll,is_resize,config) 
{
	//create conf_string for popup
	var conf_string = getWinXY(win_width,win_height);
	conf_string += (is_scroll) ? ',scrollbars=yes' : ',scrollbars=no';
	conf_string += (is_resize) ? ',resizable=yes' : ',resizable=no';
	if (config != null) conf_string += config;
	//window.alert(conf_string);
	
	//open window and set to focus
	if (pop_win_ref && (!pop_win_ref.closed)) pop_win_ref.close();
	pop_win_ref = window.open(file_name,win_name,conf_string);
	pop_win_ref.focus();
}






function docReload()
{
	if(is_nav4)document.location.reload();
}

//popup function for vision2010
function pop2010 ()
{
	popWin('http://www.docomo-europe.com/vision2010.asp','vision2010',522,529,true,false,null);
}

function popDisclaimer()
{
	popWin('http://www.docomo-europe.com/common/policy/disclaimer.html','legal',465,325,false,false,'');
}

function popUsability()
{
	popWin('http://www.docomo-europe.com/common/policy/pop_usability.html','contract',465,325,false,false,'');
}

function popNotOptimised()
{
	popWin('http://www.docomo-europe.com/not_optimised.html','optimised',465,325,false,false,'');
}

function popEnquiry(contact_type)
{
	popWin('enquiry_' + contact_type + '.html',contact_type,421,620,true,false,'');
}


function init(navItemOn)
{
	if (!plugin)	//only load rollovers if no plugin (ie. Flash 5+)
	{
		preloadImgs(img_array);	//preload nav imgs
		setNavRolls(navItemOn);	//set events for nav rollovers
	}
	
	//window.alert('page loaded');
}

function setNavRolls(navItemOn)
{
	var i, imgItem;
	
	//loop through imgs
	for (i=0;i<img_array.length;i++)
	{
		if (navItemOn != img_array[i].id)	//if item isn't current item
		{
			imgItem = (document.getElementById) ? document.getElementById(img_array[i].id) : document.images[img_array[i]].id;	//get ref to img object
		
			imgItem.onmouseover = function() { this.src = loaded_imgs[this.id].on.src };
			imgItem.onmouseout = function() { this.src = loaded_imgs[this.id].off.src };
		}
		
	}
}


//set page variables and images to load
var img_root_path = 'images/';
var img_array = new Array();
img_array[0] = {id: 'buttFoma', off: 'butt_foma.gif', on: 'butt_foma_on.gif' };
img_array[1] = {id: 'buttImodeJ', off: 'butt_imode_japan.gif', on: 'butt_imode_japan_on.gif'};
img_array[2] = {id: 'buttImodeE', off: 'butt_imode_europe.gif', on: 'butt_imode_europe_on.gif'};