	var focusError = "Por favor coloquese en un campo en particular.";
	var keypressError = "Favor de usar el Teclado Virtual.";
	var vertical_position = "bottom";
	var horizontal_position = "right";
	var vkbFillElement = "";
	var vkbFillElementSize = 0;
	var mouse_over = 0;
	var alertFieldId;
	var x=y=vkb=null;
	var ie=document.all
	var ns6=document.getElementById&&!document.all
	var ns4=document.layers;
	var moveflag="false";
	var curr_LeftPosition;
	var curr_HeightPosition;
	var smallleftposition;
	var smalltopposition;
	var focusId = 1;
	var largeleftposition;
	var largetopposition;

	var keyboardFlag="";

var initialWidth;
var initialHeight;
var keyboardchoiceflag=0;



function check_cookies(cookiename)
{

var cookiestring=""+document.cookie;
var index1=cookiestring.indexOf(cookiename);
//alert("Value of Index 1: "+index1);
if (index1==-1 || cookiename=="") cookie_val=""
var index2=cookiestring.indexOf(';',index1);
if (index2==-1) index2=cookiestring.length; 
//alert("Cookie Value: "+cookiestring);
var cookie_val=unescape(cookiestring.substring(index1+cookiename.length+1,index2));

//alert("Cokie Value"+cookie_val);

if( (cookie_val != "large") && (cookie_val != "small"))
cookie_val="small";

keyboardFlag=cookie_val;

//Commented by Gaurav 09/27/04
//eventRef=getCappKeyRef();
//eventRef.onmousedown=down;
//eventRef.onmouseup=up;
//eventRef.onmousemove=move;

}

//global variable
var global_availWidth;
var global_availHeight;
var global_LeftPosition;
var global_HeightPosition;

//fix the coordinates for signon service 
function fixinit_size()
{
  //alert("Inside fixinit");
  check_cookies("capp_keyboard");
  //alert("After Check cookies");
  var temp_Lower_height;
  var temp_Upper_height;
  var temp_Lower_Limit;
  var temp_Upper_Limit;
  var height_randomFlag="false";
  var width_randomFlag="false";
  //alert("Keyboard Flag"+keyboardFlag);

		if (ns4) 
		{
			global_availWidth = window.innerWidth;
			global_availHeight =window.innerHeight;
		}
		if (ns6)
		{
			global_availWidth = document.body.clientWidth;
			global_availHeight =window.innerHeight;			
		}
		else 
		{
			global_availWidth = document.body.clientWidth;
			global_availHeight = document.body.clientHeight;
		}
		
	if(keyboardFlag=="small")
	{
			if(screen.width <= 800)
			{

				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(420);
				temp_Upper_Limit = global_availWidth-(390);
				temp_Lower_height = global_availHeight/13;
				temp_Upper_height = global_availHeight/6;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(465);
				temp_Upper_Limit = global_availWidth-(400);
				temp_Lower_height = global_availHeight-500;
				temp_Upper_height = global_availHeight-470;
				}

				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);				

			}
			else
			{
				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(450);
				temp_Upper_Limit = global_availWidth-(390);
				temp_Lower_height = global_availHeight/13;
				temp_Upper_height = global_availHeight/6;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(465);
				temp_Upper_Limit = global_availWidth-(400);
				temp_Lower_height = global_availHeight-500;
				temp_Upper_height = global_availHeight-470;
				}

				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);
			}  

				//alert("Randome Value :"+Math.floor(Math.random()));

				//alert(" Lower Limit Width: "+temp_Lower_Limit+" Upper Limit: "+temp_Upper_Limit+" Random Number: "+global_availWidth);
				//alert(" Lower Limit Height: "+temp_Lower_height+" Upper Limit: "+temp_Upper_height+" Random Number: "+global_availHeight);

	}
	else
	{

			if(screen.width <= 800)
			{

				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(490);
				temp_Upper_Limit = global_availWidth-(470);
				temp_Lower_height = global_availHeight/13;
				temp_Upper_height = global_availHeight/6;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(485);
				temp_Upper_Limit = global_availWidth-(465);
				temp_Lower_height = global_availHeight - 500;
				temp_Upper_height = global_availHeight - 470;
				}


				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);

			}
			else
			{
				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(460);
				temp_Upper_Limit = global_availWidth-(450);
				temp_Lower_height = global_availHeight/13;
				temp_Upper_height = global_availHeight/6;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(485);
				temp_Upper_Limit = global_availWidth-(465);
				temp_Lower_height = global_availHeight - 500;
				temp_Upper_height = global_availHeight - 470;
				}


				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);
		
			}  


	}

			
				if( (global_LeftPosition >= temp_Lower_Limit) && (global_LeftPosition <= temp_Upper_Limit) )
				{
				global_availWidth =global_LeftPosition;	
				width_randomFlag="true";
				}
				else
				{
				width_randomFlag="false";
				}

				
				if( (global_HeightPosition >= temp_Lower_height) && (global_HeightPosition <= temp_Upper_height) )
				{
				global_availHeight =global_HeightPosition;	
				height_randomFlag="true";
				}  
				else
				{
				height_randomFlag="false";
				}


				//alert("Width Random Flag : "+width_randomFlag+" Height Random Flag: "+height_randomFlag);

			if(keyboardFlag=="small")
			{

				if(screen.width <= 800)
				{

					if(width_randomFlag=="false")
					{

						if(ie)
						global_availWidth=global_availWidth-(470);
						else
						global_availWidth=global_availWidth-(140);

					}

					if(height_randomFlag=="false")
					{
						if(ie)
						global_availHeight = global_availHeight/13;
						else
						global_availHeight = global_availHeight/2;

					}



				}
				else
				{
					//alert(" Random Flag not meet ");
					if(width_randomFlag=="false")
					{
						if(ie)
						global_availWidth=global_availWidth-(450);
						else
						global_availWidth=global_availWidth-(250);
					}

					if(height_randomFlag=="false")
					{
						if(ie)	
						global_availHeight = global_availHeight/13;
						else
						global_availHeight = global_availHeight/3;

					}

				}
			}
			else
			{
				if(screen.width <= 800)
				{

					if(width_randomFlag=="false")
					{
						if(ie)
						global_availWidth=global_availWidth-(450);
						else
						global_availWidth=global_availWidth-(160);

					}

					if(height_randomFlag=="false")
					{
						if(ie)
						global_availHeight = global_availHeight/13;
						else
						global_availHeight = global_availHeight/2;
					}

				}
				else
				{
					if(width_randomFlag=="false")
					{
						if(ie)
						global_availWidth=global_availWidth-(460);
						else
						global_availWidth=global_availWidth-(460);
					}

					if(height_randomFlag=="false")
					{
						if(ie)
						global_availHeight = global_availHeight/13;
						else
						global_availHeight = global_availHeight/13;
					}
				}

			}

}



//fix the coordinates for customer service 
function fixcs_size()
{

  check_cookies("capp_keyboard");

  var temp_Lower_height;
  var temp_Upper_height;
  var temp_Lower_Limit;
  var temp_Upper_Limit;
  var height_randomFlag="false";
  var width_randomFlag="false";

		if (ns4) 
		{
			global_availWidth = window.innerWidth;
			global_availHeight =window.innerHeight;
		}
		else 
		{
			global_availWidth = document.body.clientWidth;
			global_availHeight = document.body.clientHeight;
		}


	if(keyboardFlag=="small")
	{

			if(screen.width <= 800)
			{
				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(490);
				temp_Upper_Limit = global_availWidth-(470);
				temp_Lower_height = global_availHeight/4;
				temp_Upper_height = global_availHeight/3;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(500);
				temp_Upper_Limit = global_availWidth-(450);
				temp_Lower_height = global_availHeight-380;
				temp_Upper_height = global_availHeight-350;
				}

				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);

			}
			else
			{
				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(500);
				temp_Upper_Limit = global_availWidth-(450);
				temp_Lower_height = global_availHeight/4;
				temp_Upper_height = global_availHeight/3;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(500);
				temp_Upper_Limit = global_availWidth-(450);
				temp_Lower_height = global_availHeight-380;
				temp_Upper_height = global_availHeight-350;
				}

				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);

		
			}  

	}
	else
	{

			if(screen.width <= 800)
			{
				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(490);
				temp_Upper_Limit = global_availWidth-(470);
				temp_Lower_height = global_availHeight/4;
				temp_Upper_height = global_availHeight/3;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(500);
				temp_Upper_Limit = global_availWidth-(450);
				temp_Lower_height = global_availHeight-380;
				temp_Upper_height = global_availHeight-350;
				}

				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);

			}
			else
			{
				if(ie)
				{
				temp_Lower_Limit = global_availWidth-(500);
				temp_Upper_Limit = global_availWidth-(450);
				temp_Lower_height = global_availHeight/4;
				temp_Upper_height = global_availHeight/3;
				}
				else
				{
				temp_Lower_Limit = global_availWidth-(500);
				temp_Upper_Limit = global_availWidth-(450);
				temp_Lower_height = global_availHeight-380;
				temp_Upper_height = global_availHeight-350;
				}

				global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
				global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);
		
			}  


	}

			


				if( (global_LeftPosition >= temp_Lower_Limit) && (global_LeftPosition <= temp_Upper_Limit) )
				{
				global_availWidth =global_LeftPosition;	
				width_randomFlag="true";
				}
				else
				{
				width_randomFlag="false";
				}

				
				if( (global_HeightPosition >= temp_Lower_height) && (global_HeightPosition <= temp_Upper_height) )
				{
				global_availHeight =global_HeightPosition;	
				height_randomFlag="true";
				}  
				else
				{
				height_randomFlag="false";
				}



			if(keyboardFlag=="small")
			{

				if(screen.width <= 800)
				{

					if(width_randomFlag=="false")
					{
						//alert("Inside if");	
						if(ie)
						global_availWidth=global_availWidth-(470);
						else
						global_availWidth=global_availWidth-(150);
					}

					if(height_randomFlag=="false")
					{
						//alert("Inside if 2");	

						if(ie)
						{
						global_availHeight = global_availHeight/4;
						}
						else
						{
						global_availHeight = global_availHeight - 200;
						}
					}


				}
				else
				{
					if(width_randomFlag=="false")
					{


						if(ie)
						global_availWidth=global_availWidth-(450);
						else
						global_availWidth=global_availWidth-(450);

					}

					if(height_randomFlag=="false")
					{
						if(ie)
						global_availHeight = global_availHeight/3;
						else
						global_availHeight = global_availHeight/1.8;
					}
				}
			}
			else
			{
				if(screen.width <= 800)
				{

					if(width_randomFlag=="false")
					{
						if(ie)
						global_availWidth=global_availWidth-(450);
						else
						global_availWidth=global_availWidth-(140);
					}

					if(height_randomFlag=="false")
					{
						if(ie)
						global_availHeight = global_availHeight/2;
						else
						global_availHeight = global_availHeight-150;
					}

				}
				else
				{
					if(width_randomFlag=="false")
					{
						if(ie)
						global_availWidth=global_availWidth-(500);
						else
						global_availWidth=global_availWidth-(200);

					}

					if(height_randomFlag=="false")
					{
						if(ie)
						global_availHeight = global_availHeight/4;
						else
						global_availHeight = global_availHeight/1.8;

					}
				}

			}



}



	function down(e) {



		// Check if the mouse over so as not to move while clicking
		if(mouse_over == 0)
		{
			vkb = getCappKeyRef();
			
		}

		if(ie) {


			x=parseInt(window.event.offsetX);
			y=parseInt(window.event.offsetY);
		}

		else if (ns6) {
			x=parseInt(e.layerX);
			y=parseInt(e.layerY);
		}
		else {
			return false;
		}
		return false;
	}

function move(e) {
		var avail_Width = document.body.clientWidth;
		var avail_Height = document.body.clientHeight;
				
		if (ie && vkb) {
			moveflag=true;
			var vkbLeft = parseInt(vkb.style.posLeft);
			var vkbTop = parseInt(vkb.style.posTop);
			var winEventX = parseInt(window.event.clientX);
			var winEventY = parseInt(window.event.clientY);

			if((vkbLeft >=0 && vkbLeft <= avail_Width-255 || vkbLeft <=10 && winEventX-x > vkbLeft) || (vkbLeft >= avail_Width-255 && winEventX-x <= vkbLeft))
			{
				vkb.style.posLeft=winEventX-x;
				//curr_LeftPosition=vkb.style.posLeft;
				curr_LeftPosition=winEventX-x;

			}

			if(vkbTop <=10 && document.body.scrollTop+winEventY-y >= vkbTop || vkbTop >=0 && vkbTop <= document.body.scrollTop + avail_Height-140 || vkbTop >= document.body.scrollTop+avail_Height-140 && document.body.scrollTop+winEventY-y <= vkbTop)
			{
				vkb.style.posTop=winEventY-y+document.body.scrollTop;
				//curr_HeightPosition=vkb.style.posTop;
				curr_HeightPosition=winEventY-y+document.body.scrollTop;

			}
		}
		else if (ns6 && vkb) {
			moveflag=true;
			//alert("vkb.style.left: "+vkb.style.left);
			var vkbLeft = parseInt(vkb.style.left);
			var vkbTop = parseInt(vkb.style.top);
			var winEventX = parseInt(e.clientX);
			var winEventY = parseInt(e.clientY);			
			//if((isNaN(vkbLeft)) || (vkbLeft >=10 && vkbLeft <= avail_Width-330 || vkbLeft <=10 && winEventX-x > vkbLeft) || (vkbLeft >= avail_Width-330 && winEventX-x <= vkbLeft))

			if((vkbLeft >=0 && vkbLeft <= avail_Width-255 || vkbLeft <=10 && winEventX-x > vkbLeft) || (vkbLeft >= avail_Width-255 && winEventX-x <= vkbLeft))
			{
				vkb.style.left=winEventX-x+ "px";
				curr_LeftPosition=winEventX-x;

			}

			//if(vkbTop <=10 && document.body.scrollTop+winEventY-y >= vkbTop || vkbTop >=10 && vkbTop <= document.body.scrollTop + avail_Height-140 || vkbTop >= document.body.scrollTop+avail_Height-140 && document.body.scrollTop+winEventY-y <= vkbTop)
			if(vkbTop <=10 && document.body.scrollTop+winEventY-y >= vkbTop || vkbTop >=0 && vkbTop <= document.body.scrollTop + avail_Height-140 || vkbTop >= document.body.scrollTop+avail_Height-140 && document.body.scrollTop+winEventY-y <= vkbTop)
			{
				vkb.style.top=winEventY-y+document.body.scrollTop + "px";
				curr_HeightPosition=winEventY-y+document.body.scrollTop;
			}
		}
		else {
			return(false);
		}
		return false;
	}

	function up() 
	{
		//salert(" Up fired ");
		vkb=null
	}

	var ns4EventRef=null;

	function drag_drop(name){

		ns4EventRef=getCappKeyRef();
		ns4EventRef.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
		ns4EventRef.onmousedown=go
		ns4EventRef.onmouseup=stop
	}

	function go(e){
		ns4EventRef.captureEvents(Event.MOUSEMOVE)
		ns4EventRef.onmousemove=drag
		nsx=e.x
		nsy=e.y
	}

	function drag(e){
		ns4EventRef.moveBy(e.x-nsx,e.y-nsy)
		return false
	}

	function stop(){
		ns4EventRef.releaseEvents(Event.MOUSEMOVE)
	}

	function releaseNs4Event(name) {
		ns4EventRef=getCappKeyRef();
		ns4EventRef.releaseEvents(Event.MOUSEDOWN)
		ns4EventRef.releaseEvents(Event.MOUSEUP)
		ns4EventRef.releaseEvents(Event.MOUSEMOVE)
	}

	function add(val) {

		var elPtr;
		var i=0;
		var foundField = false;
		if(foundField == false) {
			elPtr = eval(vkbFillElement);
			if(elPtr) {
				// this checks for length of field
				var focusValue = new String(elPtr.value);
				if(focusValue.length<vkbFillElementSize)
					elPtr.value = focusValue + val;
					elPtr.focus();
				foundField = true;
			}
		}
		if(foundField == false) {
			alert(focusError);
		}
	}

	function del(val) {
		var elPtr;
		var i=0;
		var foundField = false;
		if(foundField == false) {
			elPtr = eval(vkbFillElement);
			if(elPtr) {
				// this checks for length of field
				var focusValue = new String(elPtr.value);
				if(focusValue.length >0) {
					focusValue = focusValue.substring(0,focusValue.length-1);
					elPtr.value = focusValue
						elPtr.focus();
				}
				foundField = true;
			}
		}
		if(foundField == false) {
			alert(focusError);
		}
	}



		function clear(val) 
		{
		var elPtr;
		elPtr = eval(vkbFillElement);
		elPtr.value = "";
		}

	
	
	
	function done(val)
	{
		hideVkb(val);
		/*var elemtId=parseInt(parseInt(focusId,10) + 1,10);
		var totaleng=document.forms[0].elements.length;
		if(elemtId < totaleng)
		document.forms[0].elements[elemtId].focus();*/
	
		
	}

	function hideVkb(fieldRef) 
	{


		if (keyboardFlag == "small")
		{
		hideVkbSmall(fieldRef)
		}
		else
		{
		hideVkbLarge(fieldRef)
		}


	}




	function hideVkbSmall(fieldRef) {
		vkbFillElement = "";
		vkbFillElementSize=0;
		var l_vkb = getCappKeyRef();
		if((ie|| ns6) && l_vkb)
			l_vkb.style.visibility = 'hidden'
		else if((ns4) && l_vkb)
			l_vkb.visibility = 'hide';
	}




	function hideVkbLarge(fieldRef) {

		vkbFillElement = "";
		vkbFillElementSize=0;
		var l_vkb = getLargeVkbRef();


		if((ie|| ns6) && l_vkb)
			l_vkb.style.visibility = 'hidden'
		else if((ns4) && l_vkb)
			l_vkb.visibility = 'hide';
	}


 function  getCappKeyRef()
 {


	if (keyboardFlag == "small")
	{
	return getVkbRef()
	}
	else
	{
	return getLargeVkbRef()
	}

 }





	function getVkbRef() {

		var l_vkb;
		if(ie) {
			l_vkb=eval("document.all.vkb");
		}
		else if (ns6) {
			l_vkb=eval("document.getElementById('vkb')");
		}
		else if (ns4) {
			l_vkb=eval("document.layers['vkb']");
		}
		return(l_vkb);
	}

	var prevKey=-100;

	function keyPress(e) {
		var key;
		if(ie)
			key = event.keyCode
		else if (ns6)
			key = e.which
		else if (ns4)	 {
			key = e.which
			if(key == prevKey) {
				key = 0;
				prevKey=-100;
			}
			else {
				prevKey=key;
			}
		}

		// Changed by Gaurav to disable all the key presses
		//if(key != 0 && key != 13 && key != 8 &&  key != 9) {
			//alert(key);
			if(key != 0) {
			alert(keypressError);
			var alertFieldName;
			var alertFieldValue;
			//alertFieldValue = alertFieldId.value;
			/*if(alertFieldValue.length >0) {
				alertFieldValue = alertFieldValue.substring(0, alertFieldValue.length-1);
				alertFieldId.value = alertFieldValue
			}*/

			alertFieldId.focus();
			return(false);
		}

	}


	function keyDown(e)
	{
		
		var key;
		if(ie)
		key=event.keyCode;

		if((key==17) || (key==8))
		{
			alert(keypressError);
			alertFieldId.focus();
			return(false);
		}

	}




	function showCursor(cursorType) {
		//if(ie) {
			var l_vkb = getCappKeyRef();			
			l_vkb.style.cursor = cursorType;
		//}

		

		if (cursorType == "hand") 
			mouse_over = 1;
		else
			mouse_over = 0; 
	}


	function showneCursor() {
			var l_vkb = getCappKeyRef();
			l_vkb.style.cursor = "move";

	/*	if (cursorType == "hand") 
			mouse_over = 1;
		else
			mouse_over = 0; */
	}




function showVkb(fieldRef)
{
	//check_cookies("capp_keyboard");

	if (keyboardFlag == "small")
	{
	showVkbSmall(fieldRef)
	}
	else
	{
	showVkbLarge(fieldRef)
	}
}


	function showVkbSmall(fieldRef) {

		vkbFillElement = fieldRef;
		var l_vkb=getCappKeyRef();

		var availWidth;
		var availHeight;

		if(moveflag == "false")
		{
			availWidth=global_availWidth;
			availHeight=global_availHeight;

		}
		else
		{
			availWidth =curr_LeftPosition;
			availHeight =curr_HeightPosition;
			moveflag=false;

		}

		if (ie && l_vkb) 
		{

			if(screen.width <= 800)
			{
					if(horizontal_position == "middle") 
					{
					l_vkb.style.posLeft = availWidth/3;
					}
					else if(horizontal_position == "left") 
					{
					l_vkb.style.posLeft = 0;
					}
					else 
					{
					l_vkb.style.posLeft = availWidth;
					}
			}
			else 
			{
					l_vkb.style.posLeft = availWidth;
			}



			if(screen.height <= 600 || availHeight <= 500) 
			{

				l_vkb.style.posTop = availHeight ;
			}
			else 
			{
				l_vkb.style.posTop=availHeight;
			}
		}
		else if (ns6 && l_vkb) 
		{
			
			if(screen.width <= 800) 
			{																
				if(horizontal_position == "middle") 
				{
					l_vkb.style.left = availWidth/3+"px";
				}
				else if(horizontal_position == "left")
				{
					l_vkb.style.left = 0+"px";
				}
				else
				{
					l_vkb.style.left = availWidth+"px";
				}
			}
			else
			{
				//alert("l_vkb.style bbbbbbb: "+l_vkb.style+", l_vkb.style.left: "+l_vkb.style.left);
				l_vkb.style.left = availWidth+"px";
				//alert("l_vkb.style.left: "+l_vkb.style.left);
			}
			//alert("l_vkb.style.left ccccccc: "+l_vkb.style.left);

			if(screen.height <= 600 || availHeight <= 500)
			{
				l_vkb.style.top = availHeight+"px";
			}
			else 
			{
				l_vkb.style.top = availHeight+"px";
				//alert("l_vkb.style.top: "+l_vkb.style.top);
			}
		}
		else if (ns4 && l_vkb) 
		{

			if(screen.width <= 800) 
			{
				if(horizontal_position == "middle") 
				{
					l_vkb.left = availWidth/3+"px";
				}
				else if(horizontal_position == "left") 
				{
					l_vkb.left = 0+"px";
				}
				else 
				{

					l_vkb.left = availWidth-320+"px";
				}
			}
			else 
			{

				l_vkb.left = availWidth-55+"px";
			}
			if(screen.height <= 600 || availHeight <= 500) 
			{

				l_vkb.top = availHeight-335+"px";
			}
			else 
			{

				l_vkb.top = availHeight/8+"px";
			}
		}

		if(fieldRef != '') {
			if((ie|| ns6) && l_vkb)
				l_vkb.style.visibility = 'visible';
			else if((ns4) && l_vkb)
				l_vkb.visibility = 'visible';

		}



	}



		function showVkbLarge(fieldRef) {

		//alert("Show vkb large" );
		vkbFillElement = fieldRef;
		var l_vkb=getCappKeyRef();
		var availWidth;
		var availHeight;
		

		if(moveflag == "false")
		{
			availWidth=global_availWidth;
			availHeight=global_availHeight;
		}
		else
		{
			availWidth =curr_LeftPosition;
			availHeight =curr_HeightPosition;
			moveflag=false;

		}



		//	availWidth = document.body.clientWidth;
		//	availHeight = document.body.clientHeight;



		if (ie && l_vkb) 
		{

			if(screen.width <= 800)
			{
					if(horizontal_position == "middle") 
					{
					l_vkb.style.posLeft = availWidth/3;
					}
					else if(horizontal_position == "left") 
					{
					l_vkb.style.posLeft = 0;
					}
					else 
					{
					l_vkb.style.posLeft = availWidth;
					}
			}
			else 
			{
						l_vkb.style.posLeft = availWidth;
	
			}



			if(screen.height <= 600 || availHeight <= 500) 
			{
				l_vkb.style.posTop = availHeight ;
			}
			else 
			{

					l_vkb.style.posTop=availHeight;
	

			}
		}
		else if (ns6 && l_vkb) 
		{
			if(screen.width <= 800) 
			{
				if(horizontal_position == "middle") 

				{
					l_vkb.style.left = availWidth/3+"px";
				}
				else if(horizontal_position == "left") 
				{
					l_vkb.style.left = 0;
				}
				else 
				{
					l_vkb.style.left = availWidth+"px";
				}
			}
			else
			{	//alert(" Inside else "); 450-500
				l_vkb.style.left = availWidth+"px";
			}

			if(screen.height <= 600 || availHeight <= 500) 
			{
					//alert("Inside if "); //350-380
					l_vkb.style.top = availHeight+"px";
			}
			else 
			{
				l_vkb.style.top = availHeight+"px";
			}
		}
		else if (ns4 && l_vkb) 
		{

			if(screen.width <= 800) 
			{
				if(horizontal_position == "middle") 
				{

					l_vkb.left = availWidth/3+"px";
				}
				else if(horizontal_position == "left") 
				{
					l_vkb.left = 0;
				}
				else 
				{

					l_vkb.left = availWidth-320+"px";
				}
			}
			else 
			{

				l_vkb.left = availWidth-550+"px";
			}
			if(screen.height <= 600 || availHeight <= 500) 
			{
				l_vkb.top = availHeight-335+"px";
			}
			else 
			{

				l_vkb.top = availHeight/8+"px";
			}
		}

		if(fieldRef != '') {
			if((ie|| ns6) && l_vkb)
				l_vkb.style.visibility = 'visible';
			else if((ns4) && l_vkb)
				l_vkb.visibility = 'visible';

		}


	}











	function getLargeVkbRef() {
		var l_vkb;
		if(ie) {
			l_vkb=eval("document.all.largevkb");
		}
		else if (ns6) {
			l_vkb=eval("document.getElementById('largevkb')");
		}
		else if (ns4) {
			l_vkb=eval("document.layers['largevkb']");
		}
		return(l_vkb);
	}


//COOKIE SCRIPTS

function getexpirydate( nodays)
{
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function getcookie(cookiename) 
{
	 var cookiestring=""+document.cookie;
	 var index1=cookiestring.indexOf(cookiename);
	 if (index1==-1 || cookiename=="") return ""; 
	 var index2=cookiestring.indexOf(';',index1);
	 if (index2==-1) index2=cookiestring.length; 
	 return (cookiestring.substring(index1+cookiename.length+1,index2));
}

function setcookie(value)
{
	cookiestring="capp_keyboard="+escape(value)+";EXPIRES="+getexpirydate(365)+";DOMAIN=gdas8.tti.com;PATH=/CappWebApp;SECURE";
	document.cookie=cookiestring;
	if(!getcookie(name))
	{
	return false;
	}
	else
	{
	return true;
	}
}


function goToLink(link_url)
{
 window.open(link_url,"CitiLinkWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=620,height=460,top=50,left=60");
}


