var w;
var h;

var deltaAppletWidth = 7;
var deltaAppletHeight = 35;
var deltaGraphWidth = 20;
var deltaGraphHeight = 50;
var c_Start, lencookie, valcookie, endcurr;
var CurrCookie= new Array();
var UnitarrayMC = new Array();
var winCurr;
var arrCcyNames = new Array();
var isTickerRunning = false
var arrIRP = parent.arrIRPeriods;
var arrCcyD = parent.arrCcyDates;
parent.isTIKon=false;
SetCookieArray();

function SetAppletSize()
{
	w=document.body.clientWidth-deltaAppletWidth;
	h=document.body.clientHeight-deltaAppletHeight;
	document.applets[0].style.width=w;
	document.applets[0].style.height=h;
}

function ResizeApplet()
{
	SetAppletSize();
	if ((w>deltaGraphWidth) && (h>deltaGraphHeight))
		document.applets[0].jsGraph_Resize(''+(w-deltaGraphWidth),''+(h-deltaGraphHeight));
}

function SetCookieArray()
{
	c_Start=0;
	CurrCookie.length=0;
	var x = document.cookie;

	if(x.indexOf('cooklen=')!=-1 && x.indexOf('cookcurr=')!=-1)
	{
		lencookie = x.split('cooklen=')[1].split(';')[0];
		valcookie = x.split('cookcurr=')[1].split(';')[0];
		for (var i=0;i<lencookie;i++)
		{
			CurrCookie[i]=valcookie.substr(c_Start,3);
			c_Start=c_Start+3;
		}
	}
}


function SetUnitarrayWithMainCurrency()
{
	var major, ccy1, ccy2;

	for (var i=1; i<parent.Unitarray.length; i++)
	{
		ccy1=parent.GLCcyValues[i]//real from index
		ccy2=parent.GLMainCurrency
		major = GetDefaultMajor(ccy1,ccy2);
		UnitarrayMC[i] = RemoveComma(top.GetRateAvg(ccy1, ccy2, major));
	}
}


function yyy()
{
	var lenCcy=parent.NewGLCcyNames.length;
	if (parent.Unitarray.length>0 && lenCcy>1)
	{
		arrCcyNames = parent.NewGLCcyNames;
		try{SetUnitarrayWithMainCurrency()} catch(e){}
		if (UnitarrayMC[1]+''=='undefined' ) { Layer2.innerHTML=''; return;}
		var strTicker='<span class="GlFonts12">';
		if(CurrCookie.length>0)
		{
			var CurrCookielen=CurrCookie.length;

			for (k=0; k<CurrCookielen; k++)
				for(i=1; i<lenCcy; i++)
					if(arrCcyNames[i]==CurrCookie[k] && i!=parent.GLMainCurrency)
						strTicker += arrCcyNames[i]+"="+UnitarrayMC[i]+"&nbsp;&nbsp;&nbsp";
		}
		else
			for(i=1; i<lenCcy; i++)
				if ( i!=parent.GLMainCurrency && arrCcyNames[i]!='')
					strTicker += arrCcyNames[i] + "=" + UnitarrayMC[i] + "&nbsp;&nbsp;&nbsp;";

		strTicker += "</span>";
		Layer2.innerHTML=strTicker;
		isTickerRunning = true;
	}
}


function Layer2_onfinish()
{ 	yyy(); }


function ArrayFind (match)
{
	match=''+match+''
	for (var i=0; ((this.length)>i ); i++)
		//if (this[i]==match) return i;
		if (this[i].toString().toUpperCase()==match.toUpperCase()) return i;
	
	// if found it
	// if not found...
	return -1;
}


function selectCurr()
{
	try { winCurr.close(); } catch(e) {}
	winCurr=window.open('chooseCurr.htm','CurrWin','width=300,height=340');
}


function MatchCurrSpot(criteria)
{
	Array.prototype.find=ArrayFind;
	var place=arrCcyNames.find(criteria);
	if (place!=-1)
		return parent.Unitarray[place];
}


//------------------------------------ GET PIPS ----------------------------------------
//------------------------( called from input forward ) -------------------------------

function GetPips(ccy1, ccy2, spotRate, openDate, valueDate,spotAsk)
{
	if (parent.deb.length==0)
		return '0','0','0';

	var DyMilli = 86400000;
	var holiday=DyMilli;
	var saturday = DyMilli*2;
	var sunday = DyMilli;
	var spotBid=spotRate+'';
	//var spotAsk=spotRate+'';
	
	if (spotAsk==undefined) spotAsk=spotRate+'';

	var daysDiff = daysInterval(ccy1, ccy2, openDate, valueDate);
	var afterDot = GetM(ccy1,ccy2,GetDefaultMajor(ccy1,ccy2));
	var 	coef = ''+ Math.pow(10,afterDot);

	var daysDiff1=daysDiff;
	var daysDiff2=daysDiff;
	
	var c1=top.GetCcyNum(ccy1);
	var c2=top.GetCcyNum(ccy2);

	if (parseInt(daysDiff)>parseInt(arrCcyD[arrCcyD.length-1][c1-1]) ) daysDiff1=arrCcyD[arrCcyD.length-1][c1-1];
	if (parseInt(daysDiff)>parseInt(arrCcyD[arrCcyD.length-1][c2-1]) ) daysDiff2=arrCcyD[arrCcyD.length-1][c2-1];
	var i1, i2;
	for (i1=1; i1<arrCcyD.length; i1++)
		if (toFloat(arrCcyD[i1][c1-1]) >= toFloat(daysDiff1))
			break;

	for (i2=1; i2<arrCcyD.length; i2++)
		if (toFloat(arrCcyD[i2][c2-1])>=toFloat(daysDiff2))
			break;

	var ix11 = i1-1
	var ix12 = (i1==arrCcyD.length) ? (i1-1):i1
	var ix21 = i2-1
	var ix22 = (i2==arrCcyD.length) ? (i2-1):i2

	var dateLeft1 = ''+arrCcyD[ix11][c1-1];
	var dateRight1 = ''+arrCcyD[ix12][c1-1];
	var dateLeft2 = ''+arrCcyD[ix21][c2-1];
	var dateRight2 = ''+arrCcyD[ix22][c2-1];

	if (dateLeft1==dateRight1) dateLeft1--;
	if (dateLeft2==dateRight2) dateLeft2--;

	var intrestL1B = ''+parent.deb[ix11][c1-1];
	var intrestR1B = ''+parent.deb[ix12][c1-1];
	var intrestL2B = ''+parent.deb[ix21][c2-1];
	var intrestR2B = ''+parent.deb[ix22][c2-1];

	var intrestL1A = ''+parent.dea[ix11][c1-1];
	var intrestR1A = ''+parent.dea[ix12][c1-1];
	var intrestL2A = ''+parent.dea[ix21][c2-1];
	var intrestR2A = ''+parent.dea[ix22][c2-1];

	var basis1 = ''+top.arrCcyBasis[c1];
	var basis2 = ''+top.arrCcyBasis[c2];

	//prompt('1',ccy1+','+ccy2+','+ spotBid+','+spotAsk+','+daysDiff1+','+dateLeft1+','+dateRight1+','+intrestL1B+','+intrestR1B+','+intrestL1A+','+intrestR1A+','+basis1+','+dateLeft2+','+dateRight2+','+intrestL2B+','+intrestR2B+','+intrestL2A+','+intrestR2A+','+basis2+','+coef)
	var returnValue = ''+document.PipsCalc.PipsForwards(ccy1+'', ccy2+'', spotBid, spotAsk, daysDiff1, dateLeft1, dateRight1, intrestL1B, intrestR1B, intrestL1A, intrestR1A, basis1, dateLeft2, dateRight2, intrestL2B, intrestR2B, intrestL2A, intrestR2A, basis2, coef)
	return returnValue+","+afterDot;
}

//------------------------------ GET PIPS 2 --------------------------------------------
//------------------------( called from calculator ) ------------------------------------

function GetPips2(ccy1, ccy2, spotBid, spotAsk, daysDiff)
{

	if (typeof(parent.deb) === "undefined"  ||  parent.deb.length==0)
		return '0','0','0';

	var afterDot = GetM(ccy1,ccy2,ccy1);
	var 	coef = ""+ Math.pow(10,afterDot);

	var daysDiff1=daysDiff;
	var daysDiff2=daysDiff;

	var c1=top.GetCcyNum(ccy1);
	var c2=top.GetCcyNum(ccy2);

	if (parseInt(daysDiff)>parseInt(arrCcyD[arrCcyD.length-1][c1-1]) ) daysDiff1=arrCcyD[arrCcyD.length-1][c1-1];
	if (parseInt(daysDiff)>parseInt(arrCcyD[arrCcyD.length-1][c2-1]) ) daysDiff2=arrCcyD[arrCcyD.length-1][c2-1];
	var i1, i2;
	for (i1=1; i1<arrCcyD.length; i1++)
		if (parseInt(arrCcyD[i1][c1-1]) >= parseInt(daysDiff1))
			break;

	for (i2=1; i2<arrCcyD.length; i2++)
		if (toFloat(arrCcyD[i2][c2-1])>=toFloat(daysDiff2))
			break;

	var ix11 = i1-1
	var ix12 = (i1==arrCcyD.length) ? (i1-1):i1
	var ix21 = i2-1
	var ix22 = (i2==arrCcyD.length) ? (i2-1):i2

	var dateLeft1 = ''+arrCcyD[ix11][c1-1];
	var dateRight1 = ''+arrCcyD[ix12][c1-1];
	var dateLeft2 = ''+arrCcyD[ix21][c2-1];
	var dateRight2 = ''+arrCcyD[ix22][c2-1];

	if (dateLeft1==dateRight1) dateLeft1--;
	if (dateLeft2==dateRight2) dateLeft2--;

	var intrestL1B = ''+parent.deb[ix11][c1-1];
	var intrestR1B = ''+parent.deb[ix12][c1-1];
	var intrestL2B = ''+parent.deb[ix21][c2-1];
	var intrestR2B = ''+parent.deb[ix22][c2-1];

	var intrestL1A = ''+parent.dea[ix11][c1-1];
	var intrestR1A = ''+parent.dea[ix12][c1-1];
	var intrestL2A = ''+parent.dea[ix21][c2-1];
	var intrestR2A = ''+parent.dea[ix22][c2-1];

	var basis1 = ''+top.arrCcyBasis[c1];
	var basis2 = ''+top.arrCcyBasis[c2];

	//prompt('2',ccy1+','+ccy2+',spotBid='+ spotBid+',spotAsk='+spotAsk+',daysDiff1='+daysDiff1+',dateLeft1='+dateLeft1+',dateRight1='+dateRight1+',intrestL1B='+intrestL1B+',intrestR1B='+intrestR1B+',intrestL1A='+intrestL1A+',intrestR1A='+intrestR1A+',basis1='+basis1+',dateLeft2='+dateLeft2+',dateRight2='+dateRight2+',intrestL2B='+intrestL2B+',intrestR2B='+intrestR2B+',intrestL2A='+intrestL2A+',intrestR2A='+intrestR2A+',basis2='+basis2+',coef='+coef)
	var returnValue = ''+document.PipsCalc.PipsForwards(ccy1+'', ccy2+'', spotBid, spotAsk, daysDiff1, dateLeft1, dateRight1, intrestL1B, intrestR1B, intrestL1A, intrestR1A, basis1, dateLeft2, dateRight2, intrestL2B, intrestR2B, intrestL2A, intrestR2A, basis2, coef)
	return returnValue+","+afterDot;
}

//------------------------------ GET PIPS 3 --------------------------------------------
//------------------------( called from calculator ) ------------------------------------

function GetPips3(ccy1, ccy2, spotBid, spotAsk, IR1, IR2, daysDiff)
{
	if (parent.deb.length==0)
		return '0','0','0';

	var afterDot = GetM(ccy1,ccy2,ccy1);
	var 	coef = ""+ Math.pow(10,afterDot);

	var daysDiff1=daysDiff;
	var daysDiff2=daysDiff;

	var c1=top.GetCcyNum(ccy1);
	var c2=top.GetCcyNum(ccy2);

	if (parseInt(daysDiff)>parseInt(arrCcyD[arrCcyD.length-1][c1-1]) ) daysDiff1=arrCcyD[arrCcyD.length-1][c1-1];
	if (parseInt(daysDiff)>parseInt(arrCcyD[arrCcyD.length-1][c2-1]) ) daysDiff2=arrCcyD[arrCcyD.length-1][c2-1];
	var i1, i2;
	for (i1=1; i1<arrCcyD.length; i1++)
		if (parseInt(arrCcyD[i1][c1-1]) >= parseInt(daysDiff1))
			break;

	for (i2=1; i2<arrCcyD.length; i2++)
		if (toFloat(arrCcyD[i2][c2-1])>=toFloat(daysDiff2))
			break;

	var dateLeft1 = ''+arrCcyD[i1-1][c1-1];
	if (i1==arrCcyD.length) i1--;
	var dateRight1 = ''+arrCcyD[i1][c1-1];
	var dateLeft2 = ''+arrCcyD[i2-1][c2-1];
	if (i2==arrCcyD.length) i2--;
	var dateRight2 = ''+arrCcyD[i2][c2-1];

	if (dateLeft1==dateRight1) dateLeft1--;
	if (dateLeft2==dateRight2) dateLeft2--;

	var basis1 = ''+top.arrCcyBasis[c1];
	var basis2 = ''+top.arrCcyBasis[c2];

	//prompt('3',ccy1+','+ccy2+','+ spotBid+','+spotAsk+','+daysDiff1+','+dateLeft1+','+dateRight1+','+IR1+','+IR1+','+IR1+','+IR1+','+basis1+','+dateLeft2+','+dateRight2+','+IR2+','+IR2+','+IR2+','+IR2+','+basis2+','+coef)
	var returnValue = ''+document.PipsCalc.PipsForwards(ccy1+'', ccy2+'', spotBid, spotAsk, daysDiff1, dateLeft1, dateRight1, IR1, IR1, IR1, IR1, basis1, dateLeft2, dateRight2, IR2, IR2, IR2, IR2, basis2, coef)
	//prompt('',returnValue)
	return returnValue+","+afterDot;
}


function PipsFwds(ccy1, ccy2, spotBid, spotAsk, daysDiff1, dateLeft1, dateRight1, intrestL1B, intrestR1B, intrestL1A, intrestR1A, dateLeft2, dateRight2, intrestL2B, intrestR2B, intrestL2A, intrestR2A, coef)
{
	var basis1 = ''+top.arrCcyBasis[top.GetCcyNum(ccy1)];
	var basis2 = ''+top.arrCcyBasis[top.GetCcyNum(ccy2)];
	//prompt('',ccy1+','+ccy2+','+ spotBid+','+spotAsk+','+daysDiff1+','+dateLeft1+','+dateRight1+','+intrestL1B+','+intrestR1B+','+intrestL1A+','+intrestR1A+','+basis1+','+dateLeft2+','+dateRight2+','+intrestL2B+','+intrestR2B+','+intrestL2A+','+intrestR2A+','+basis2+','+coef)
	return document.PipsCalc.PipsForwards(ccy1, ccy2, spotBid, spotAsk, daysDiff1, dateLeft1, dateRight1, intrestL1B, intrestR1B, intrestL1A, intrestR1A, basis1, dateLeft2, dateRight2, intrestL2B, intrestR2B, intrestL2A, intrestR2A, basis2, coef)
}

//-------------------------- GET INTEREST VALUE --------------------------
//------------------------ ( called from calculators ) ------------------------

function GetInterest(ccy, daysDiff)
{
	var i1;
	if (toFloat(daysDiff)>toFloat(arrIRP[arrIRP.length-1]))
		daysDiff=arrIRP[arrIRP.length-1]

	var c=top.top.GetCcyNum(ccy);

	for (i1=1; i1<arrCcyD.length; i1++)
		if (toFloat(arrCcyD[i1][c-1]) >= toFloat(daysDiff))
			break;

	var ix1 = i1-1
	var ix2 = (i1==arrCcyD.length) ? (i1-1):i1

	var dateLeft = ''+arrCcyD[ix1][c-1];
	var dateRight = ''+arrCcyD[ix2][c-1];
	if (toFloat(daysDiff)>toFloat(dateRight)) daysDiff = dateRight;
	if (dateLeft==dateRight) dateLeft--;

	var intrestLB = ''+parent.deb[ix1][c-1];
	var intrestRB = ''+parent.deb[ix2][c-1];
	var intrestLA = ''+parent.dea[ix1][c-1];
	var intrestRA = ''+parent.dea[ix2][c-1];

	//prompt('', daysDiff+','+dateLeft+','+dateRight+','+intrestLB+','+intrestRB+','+intrestLA+','+intrestRA)
	var returnValue = ''+document.PipsCalc.GetInterestRun(daysDiff,dateLeft,dateRight,intrestLB,intrestRB,intrestLA,intrestRA)
	return returnValue
}


//-------------------------- GET VOLATILITY VALUE ------------------------
//------------------------ ( called from calculators ) ------------------------

function GetVolatility(ccy1, ccy2, daysDiff)
{
	if (toFloat(daysDiff)>toFloat(arrIRP[arrIRP.length-1]))
		daysDiff=arrIRP[arrIRP.length-1]

	for (i=1; i<arrIRP.length; i++)
		if (toFloat(arrIRP[i])>=toFloat(daysDiff))
			break;

	var dateLeft = ""+arrIRP[i-1];
	var dateRight = ""+arrIRP[i];

	var c12=top.GLCcyNames[ccy1]+top.GLCcyNames[ccy2];
	var c21=top.GLCcyNames[ccy2]+top.GLCcyNames[ccy1];

	for (j=0; j<parent.vol[0].length;j++)
		if (parent.vol[0][j]==c12 || parent.vol[0][j]==c21)
			break;

	if (j>=parent.vol[0].length || (i+1)>=parent.vol.length)
	{
		alert("There is no volatility value in the system for the given pair of currencies.\nThe default volatility value will be set.");
		volLB = '10';
		volRB = '10';
		volLA = '10';
		volRA = '10';
	}
	else
	{
		volLB = ''+parent.vol[i][j];
		volRB = ''+parent.vol[i+1][j];
		volLA = ''+parent.vola[i][j];
		volRA = ''+parent.vola[i+1][j];
	}

	//prompt('',daysDiff+','+dateLeft+','+dateRight+','+volLB+','+volRB+','+volLA+','+volRA)
	var returnValue = ''+document.PipsCalc.GetVolatilityRun(daysDiff+'', dateLeft, dateRight, volLB, volRB, volLA, volRA)
	return returnValue
}

//-------------------------- GET VANILLA VALUES ----------------------------------------
//----------------------- ( called from input vanilla ) -------------------------------------

function GetVanillaValues (ccy1, ccy2, ccyM, strike, spotBid, spotAsk, openDate, expiryDate, deliveryDate, delta, optType)
{
	var afterDot = GetM(ccy1,ccy2,ccy1);
	var 	coef = ""+ Math.pow(10,afterDot);

	if (spotBid==null)
	{
		spotBid = top.GetRate(ccy1,ccy2,ccyM,'bid');
		spotAsk = top.GetRate(ccy1,ccy2,ccyM,'ask');
	}
	var timeVol = daysDifferenceVannila(expiryDate, openDate)+'';
	if (delta != null)
		var timeInt = ""+(parseInt(timeVol)+parseInt(delta));
	else
		var timeInt = daysDifference(deliveryDate, openDate) - SpotDayShift(openDate, ccy1, ccy2);

	if (toFloat(timeInt)>toFloat(arrIRP[arrIRP.length-1]))
		timeInt=arrIRP[arrIRP.length-1]

	var c1=top.GetCcyNum(ccy1);
	var c2=top.GetCcyNum(ccy2);

	var i1;
	//-- IR ccy 1
	for (i1=1; i1<arrCcyD.length; i1++)
		if (toFloat(arrCcyD[i1][c1-1]) >= toFloat(timeInt))
			break;

	var ix1 = i1-1
	var ix2 = (i1==arrCcyD.length) ? (i1-1):i1
	
	var dateLeft1 = ''+arrCcyD[ix1][c1-1];
	var dateRight1 = ''+arrCcyD[ix2][c1-1];

	var intrestL1B = ''+parent.deb[ix1][c1-1];
	var intrestR1B = ''+parent.deb[ix2][c1-1];
	var intrestL1A = ''+parent.dea[ix1][c1-1];
	var intrestR1A = ''+parent.dea[ix2][c1-1];

	//-- IR ccy 2
	for (i1=1; i1<arrCcyD.length; i1++)
		if (toFloat(arrCcyD[i1][c2-1]) >= toFloat(timeInt))
			break;

	ix1 = i1-1
	ix2 = (i1==arrCcyD.length) ? (i1-1):i1

	var dateLeft2 = ''+arrCcyD[ix1][c2-1];
	var dateRight2 = ''+arrCcyD[ix2][c2-1];

	var intrestL2B = ''+parent.deb[ix1][c2-1];
	var intrestR2B = ''+parent.deb[ix2][c2-1];
	var intrestL2A = ''+parent.dea[ix1][c2-1];
	var intrestR2A = ''+parent.dea[ix2][c2-1];

	//--- vols
	if (toFloat(timeVol)>toFloat(arrIRP[arrIRP.length-1]))
		timeVol=arrIRP[arrIRP.length-1]

	for (i=1; i<arrIRP.length; i++)
		if (toFloat(arrIRP[i])>=toFloat(timeVol))
			break;

	var dateVLeft = ""+arrIRP[i-1];
	var dateVRight = ""+arrIRP[i];

	var c12=top.GLCcyNames[ccy1]+top.GLCcyNames[ccy2];
	var c21=top.GLCcyNames[ccy2]+top.GLCcyNames[ccy1];

	for (j=0; j<parent.vol[0].length;j++)
		if (parent.vol[0][j]==c12 || parent.vol[0][j]==c21)
			break;

	if (j>=parent.vol[0].length || (i+1)>=parent.vol.length)
	{
		if (top.MainWin.bodyframe.strActionName+'' == 'VanillaCalculator')
			alert("There is no volatility value in the system for the given pair of currencies.\nThe default volatility value will be set.");
		volLB = '10';
		volRB = '10';
		volLA = '10';
		volRA = '10';
	}
	else
	{
		volLB = ''+parent.vol[i][j];
		volRB = ''+parent.vol[i+1][j];
		volLA = ''+parent.vola[i][j];
		volRA = ''+parent.vola[i+1][j];
	}

	var basis1 = ''+top.arrCcyBasis[c1];
	var basis2 = ''+top.arrCcyBasis[c2];

	//prompt ('', ccy1+', '+ccy2+', '+ccyM+', '+strike+', '+spotBid+', '+spotAsk+', '+timeInt+', '+dateLeft1+', '+dateRight1+', '+intrestL1B+', '+intrestR1B+', '+intrestL1A+', '+intrestR1A+', '+basis1+', '+dateLeft2+', '+dateRight2+', '+intrestL2B+', '+intrestR2B+', '+intrestL2A+', '+intrestR2A+', '+basis2+', '+timeVol+', '+dateVLeft+', '+dateVRight+', '+volLB+', '+volRB+', '+volLA+', '+volRA+', '+optType+', '+coef)
	var returnValue = ''+document.PipsCalc.VanilaResult (ccy1+'', ccy2+'', ccyM+'', strike, spotBid, spotAsk, timeInt, dateLeft1, dateRight1, intrestL1B, intrestR1B, intrestL1A, intrestR1A, basis1, dateLeft2, dateRight2, intrestL2B, intrestR2B, intrestL2A, intrestR2A, basis2, timeVol, dateVLeft, dateVRight, volLB, volRB, volLA, volRA, optType, coef)
	return returnValue
}


function GetVanillaValuesCalc(ccy1, ccy2, ccyM, strike, spot_bid, spot_ask, timeInt, interest1_bid, interest1_ask, interest2_bid, interest2_ask, timeVol, vol_bid, vol_ask, OptStyle,afterDot)
{
	if (afterDot==undefined) afterDot = GetM(ccy1,ccy2,ccyM);
	var 	coef = ''+ Math.pow(10,afterDot);
	var basis1 = ''+top.arrCcyBasis[top.GetCcyNum(ccy1)];
	var basis2 = ''+top.arrCcyBasis[top.GetCcyNum(ccy2)];

	//prompt ('',ccy1+', '+ccy2+', '+ccyM+', '+strike+', '+spot_bid+', '+spot_ask+', '+timeInt+', '+interest1_bid+', '+interest1_ask+', '+basis1+', '+interest2_bid+', '+interest2_ask+', '+basis2+', '+timeVol+', '+vol_bid+', '+vol_ask+', '+OptStyle+', '+coef)
	var returnValue = ''+document.PipsCalc.VanilaResultCalc(ccy1+'', ccy2+'', ccyM+'', strike+'', spot_bid+'', spot_ask+'', timeInt+'', interest1_bid+'', interest1_ask+'', basis1, interest2_bid+'', interest2_ask+'', basis2, timeVol+'', vol_bid+'', vol_ask+'', OptStyle+'', coef)
	return returnValue;
}

//===============================================================//


function daysInterval(ccy1, ccy2, openDate, valueDate)
{
	var Odate= StringDate2Object(openDate);
	var Valdate = StringDate2Object(valueDate)
	var days = new Date(Valdate.getTime() - Odate.getTime());
	var DyMilli = 1000*60*60*24;
	days = days/DyMilli - SpotDayShift(openDate, ccy1, ccy2);
	days=Math.floor(days);
	return days;
}


function daysDifferenceVannila(strDate1,strDate2)
{
	if (strDate1==strDate2) return 1;
	else return daysDifference(strDate1,strDate2);
}

window.onunload = window_onunload;
function window_onunload()
{ try { winCurr.close(); } catch(e) {} }


function window_onload()
{ 	parent.window_Tiker_onload() }
