function displayTip(title, id, prefix, flag)
{
	TagToTip(prefix + "_" + id, TITLE, title, TITLEBGCOLOR, "#000000", BORDERCOLOR, "#000000", PADDING, 0, FADEIN, 200, FADEOUT, 200, DURATION, -200, SHADOW, true, SHADOWCOLOR, "#000000", BGCOLOR, '#CCCCCC', STICKY, flag, CLICKCLOSE, flag);	
}

function display(item, destination)
{
	document.getElementById(destination).innerHTML = document.getElementById(item).innerHTML;
}


/************************************************************
	Functions to place a block in the middle of the srceen
*************************************************************/

function returnSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var result = new Array(myWidth,myHeight);
  return result;
}

function windowCenter(myId) {
	result=returnSize();
	var myWidth=result[0];
	var myHeight=result[1];
	var elementWidth=document.getElementById(myId).offsetWidth;
	var elementHeight=document.getElementById(myId).offsetHeight;
        var myScrollLeft=document.documentElement.scrollLeft;
	var myScrollTop=document.documentElement.scrollTop;
	var posX=myScrollLeft+myWidth-myWidth/2-elementWidth/2
	var posY=myScrollTop+myHeight-myHeight/2-elementHeight/2;
	document.getElementById(myId).style.left=posX+"px";
	document.getElementById(myId).style.top=posY+"px";
}

/*********************************************************
	Functions to create popups on the product section
**********************************************************/

// function to switch the css display propreties of an element
function switch_display(div_id) {
	var el = document.getElementById(div_id);
	if(el.style.display == 'none'){
		el.style.display = 'block';
	}
	else{
		el.style.display = 'none';
	}
}

// function to assign x position of the popup
function blanket_size(popUpDivVar,x) {
	var x=x/2;
	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';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-x;//x is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}

// function to assign y position of the popup
function window_pos(popUpDivVar,y) {
	var y=y/2;
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-y;// y is half popup's width
	popUpDiv.style.left = window_width + 'px';
}

// function to close the popup
function hide_popup(div_id) {
	var el1 = document.getElementById(div_id);
	var el2 = document.getElementById('blanket');
	el1.style.display = 'none';
	el2.style.display = 'none';
}

// Main function to create the popup
function popup(windowname,x,y) {
	blanket_size(windowname,x);
	window_pos(windowname,y);
	switch_display('blanket');
	switch_display(windowname);		
}
