function ClickButton(pE, pId) 
{
    var myEvent = pE ? pE : window.event;
    var myButton = document.getElementById(pId);

    if (myButton) 
    {
        if (myEvent.keyCode == 13) 
        {
            myButton.click();
            return false;
        }
    }
}  

function HelpOpenClose(pId,pMax,pMin)
{
	document.getElementById(pMax).style.display = 'none';
	document.getElementById(pMin).style.display = 'none';

	if (document.getElementById(pId).style.display == 'none')
	{
		document.getElementById(pId).style.display = '';
		document.getElementById(pMin).style.display = '';
	}
	else
	{
		document.getElementById(pId).style.display = 'none';
		document.getElementById(pMax).style.display = '';
	}
}

function JumpPayType()
{
	if (document.all)
	{
		document.getElementById('txtFMA040_Id').innerText='';
		document.getElementById('divCreditCard').style.display='none';
		document.getElementById('divBank').style.display='none';
		document.getElementById('txtSMF022_PayType').innerText = '';
		document.getElementById('tabCreditCard').style.display='none';
		document.getElementById('tabBank').style.display='none';
		
		document.getElementById('txtSMF022_CardName').value = '';
		document.getElementById('txtSMF022_CardNo').value = '';
		document.getElementById('ddlSMF022_CardType').options[0].selected = true;
		document.getElementById('ddlSMF022_CardMonth').options[0].selected = true;
		document.getElementById('ddlSMF022_CardYear').options[0].selected = true;
		document.getElementById('txtSMF022_CardCvc').value = '';
		
		document.getElementById('labSMF022_CardName').style.display = 'none';
		document.getElementById('labSMF022_CardNo').style.display = 'none';
		document.getElementById('labSMF022_CardType').style.display = 'none';
		document.getElementById('labSMF022_CardMonth').style.display = 'none';
		document.getElementById('labSMF022_CardYear').style.display = 'none';
		document.getElementById('labSMF022_CardCvc').style.display = 'none';
	
		for(i=0;i< document.Form1.length;i++)
		{
			if (document.Form1.elements[i].type == 'radio')
			{
				document.Form1.elements[i].checked = false;
			}
		}   

		switch(document.getElementById("ddlSMF022_PayType").options[document.getElementById("ddlSMF022_PayType").selectedIndex].value)
		{
			case "1" :
				document.getElementById('txtSMF022_PayType').innerText = '1';
				document.getElementById('divCreditCard').style.display='';
				break;
			case "2" :
				document.getElementById('txtSMF022_PayType').innerText = '2';
				break;
			case "3" :
				document.getElementById('txtSMF022_PayType').innerText = '3';
				document.getElementById('divBank').style.display='';
				break;
		}
	}
	else
	{
		// Firefox Block
		document.getElementById('txtFMA040_Id').value ='';
		document.getElementById('divCreditCard').style.display='none';
		document.getElementById('divBank').style.display='none';
		document.getElementById('txtSMF022_PayType').value = '';
		document.getElementById('tabCreditCard').style.display='none';
		document.getElementById('tabBank').style.display='none';
		
		document.getElementById('txtSMF022_CardName').value = '';
		document.getElementById('txtSMF022_CardNo').value = '';
		document.getElementById('ddlSMF022_CardType').options[0].selected = true;
		document.getElementById('ddlSMF022_CardMonth').options[0].selected = true;
		document.getElementById('ddlSMF022_CardYear').options[0].selected = true;
		document.getElementById('txtSMF022_CardCvc').value = '';
		
		document.getElementById('labSMF022_CardName').style.display = 'none';
		document.getElementById('labSMF022_CardNo').style.display = 'none';
		document.getElementById('labSMF022_CardType').style.display = 'none';
		document.getElementById('labSMF022_CardMonth').style.display = 'none';
		document.getElementById('labSMF022_CardYear').style.display = 'none';
		document.getElementById('labSMF022_CardCvc').style.display = 'none';
	
		for(i=0;i< document.Form1.length;i++)
		{
			if (document.Form1.elements[i].type == 'radio')
			{
				document.Form1.elements[i].checked = false;
			}
		}   

		switch(document.getElementById("ddlSMF022_PayType").options[document.getElementById("ddlSMF022_PayType").selectedIndex].value)
		{
			case "1" :
				document.getElementById('txtSMF022_PayType').value = '1';
				document.getElementById('divCreditCard').style.display='';
				break;
			case "2" :
				document.getElementById('txtSMF022_PayType').value = '2';
				break;
			case "3" :
				document.getElementById('txtSMF022_PayType').value = '3';
				document.getElementById('divBank').style.display='';
				break;
		}
	}
}

function CheckSelect(pLocation,pThis,pId,pTextId)
{
	if(document.all)
	{
		if (pLocation = 'CreditCard')
		{
			for(i=0;i< document.Form1.length;i++)
			{
				if (document.Form1.elements[i].type == 'radio')
				{
					document.Form1.elements[i].checked = false;
				}
			}   
		
			document.getElementById('txtSMF022_CardName').value = '';
			document.getElementById('txtSMF022_CardNo').value = '';
			document.getElementById('ddlSMF022_CardType').options[0].selected = true;
			document.getElementById('ddlSMF022_CardMonth').options[0].selected = true;
			document.getElementById('ddlSMF022_CardYear').options[0].selected = true;
			document.getElementById('txtSMF022_CardCvc').value = '';
		
			pThis.checked = true;          
			document.getElementById('txtFMA040_Id').innerText = pId;
			document.getElementById('tabCreditCard').style.display = '';
			document.getElementById('labSelectCardName').innerText = document.getElementById(pTextId).innerText;
		}

		if (pLocation = 'Bank')
		{
			for(i=0;i< document.Form1.length;i++)
			{
				if (document.Form1.elements[i].type == 'radio')
				{
				document.Form1.elements[i].checked = false;
				}
			}   
		
			pThis.checked = true;          
			document.getElementById("txtFMA040_Id").innerText = pId;
			document.getElementById('tabBank').style.display = '';
			document.getElementById('labSelectBank').innerText = document.getElementById(pTextId).innerText;
		}
	}
	else
	{
		//Firefox Block
		if (pLocation == 'CreditCard')
		{
			for(i=0;i< document.Form1.length;i++)
			{
				if (document.Form1.elements[i].type == 'radio')
				{
					document.Form1.elements[i].checked = false;
				}
			}   
		
			document.getElementById('txtSMF022_CardName').value = '';
			document.getElementById('txtSMF022_CardNo').value = '';
			document.getElementById('ddlSMF022_CardType').options[0].selected = true;
			document.getElementById('ddlSMF022_CardMonth').options[0].selected = true;
			document.getElementById('ddlSMF022_CardYear').options[0].selected = true;
			document.getElementById('txtSMF022_CardCvc').value = '';
		
			pThis.checked = true;          
			document.getElementById('txtFMA040_Id').value = pId;
			document.getElementById('tabCreditCard').style.display = '';
			document.getElementById('labSelectCardName').innerHTML = document.getElementById(pTextId).innerHTML;
		}

		
		if (pLocation == 'Bank')
		{
			for(i=0;i< document.Form1.length;i++)
			{
				if (document.Form1.elements[i].type == 'radio')
				{
				document.Form1.elements[i].checked = false;
				}
			}   
		
			pThis.checked = true;          
			document.getElementById("txtFMA040_Id").value = pId;
			document.getElementById('tabBank').style.display = '';
			document.getElementById('labSelectBank').innerHTML = document.getElementById(pTextId).innerHTML;
		}
	}
}

function AreaControl(pType)
{
	myRet = false;
	myFirstAccept = false;
	
	if(pType == "1")
	{
		if (document.getElementById("ddlAdvQuestion").options[document.getElementById("ddlAdvQuestion").selectedIndex].value == '-1')
		{
			alert("Ön Sipariş Sepet Onaylamasını Yapınız.");
		}
		else
		{
			myFirstAccept = true;
		}
	}
	else
	{
		myFirstAccept = true;
	}
	
	if (myFirstAccept == true)
	{
		document.getElementById('labSMF022_CardName').style.display = 'none';
		document.getElementById('labSMF022_CardNo').style.display = 'none';
		document.getElementById('labSMF022_CardType').style.display = 'none';
		document.getElementById('labSMF022_CardMonth').style.display = 'none';
		document.getElementById('labSMF022_CardYear').style.display = 'none';
		document.getElementById('labSMF022_CardCvc').style.display = 'none';
	
		switch(document.getElementById('txtSMF022_PayType').value)
		{
			case "1" :
				if (document.getElementById('txtFMA040_Id').value == '')
				{
					alert('Kart Seçimi Yapınız.');
				}
				else
				{
					if (document.getElementById('txtSMF022_CardName').value == '')
					{
						alert('Kart Üzerindeki İsmi Giriniz.');
						document.getElementById('labSMF022_CardName').style.display = '';
					}
					else
					{
						if (document.getElementById('txtSMF022_CardNo').value == '')
						{
							alert('Kart Numarasını Giriniz.');
							document.getElementById('labSMF022_CardNo').style.display = '';
						}
						else
						{
							if (document.getElementById("ddlSMF022_CardType").options[document.getElementById("ddlSMF022_CardType").selectedIndex].value == '-1')
							{
								alert('Kart Tipini Seçiniz.');
								document.getElementById('labSMF022_CardType').style.display = '';
							}
							else
							{
								if (document.getElementById("ddlSMF022_CardMonth").options[document.getElementById("ddlSMF022_CardMonth").selectedIndex].value == '-1')
								{
									alert('Son Kullanma Ayını Seçiniz.');
									document.getElementById('labSMF022_CardMonth').style.display = '';
								}
								else
								{
									if (document.getElementById("ddlSMF022_CardYear").options[document.getElementById("ddlSMF022_CardYear").selectedIndex].value == '-1')
									{
										alert('Son Kullanma Yılını Seçiniz.');
										document.getElementById('labSMF022_CardYear').style.display = '';
									}
									else
									{
										if (document.getElementById('txtSMF022_CardCvc').value == '')
										{
											alert('Kart Güvenlik Kodunu Giriniz.');
											document.getElementById('labSMF022_CardCvc').style.display = '';
										}
										else
										{
											if (document.getElementById('txtSMF022_CardNo').value.length < 16)
											{
												alert('Kart Numarası 16 Handen Küçük Olamaz.');
												document.getElementById('labSMF022_CardNo').style.display = '';
											}
											else
											{
												myRet = true;
											}
										}
									}
								}
							}
						}
					}
				}
				break;
			case "2":
				myRet = true;
				break;
			case "3" :
				if (document.getElementById('txtFMA040_Id').value == '')
				{
					alert('Banka Seçimi Yapınız.')
				}
				else
				{
					myRet = true;
				}
				break;
			default :
				alert('Ödeme Tipi Seçimi Yapınız.')
				break;
		}
	}

	return myRet;
}

function FindBox(pId,pBoxId)
{
	if(document.getElementById(pId).value != '')
	{
		document.getElementById('myHeader_tbcLoad').style.display = '';
		document.getElementById(pBoxId).style.display = '';
		document.getElementById(pBoxId).style.top = 167 ;
		if(document.body.clientWidth > 908)
		{
			document.getElementById(pBoxId).style.left = (((document.body.clientWidth - 908) / 2) + 4);
		}
		else
		{
			document.getElementById(pBoxId).style.left = 4;
		}
		axFindBox(document.getElementById(pId).value);
	}
	else
	{
		document.getElementById(pBoxId).style.display = 'none';
	}
}

function ShowPicture(pId,pSMA010_Id,myEvent)
{
	if(document.all)
	{
		if (pSMA010_Id != '')
		{
			document.getElementById(pId).style.cursor = 'hand';
			cTop = document.body.scrollTop + event.y;
			cLeft = document.body.scrollLeft + event.x;
			cHeight = screen.availHeight;
			cTopX = cTop + 234;
			if (cTopX > cHeight){cTop = cTop - 134;}
			document.getElementById("divPicture").style.display = '';
			document.getElementById("divPicture").style.top = cTop + 5;
			document.getElementById("divPicture").style.left = cLeft + 5;
			document.getElementById("imgPictureDiv").src = "Tools/FlushFile.aspx?Q1=" + pSMA010_Id + "&Q2=123&Q3=123&Q4=SMA012";
		}
		else
		{
			document.getElementById("divPicture").style.display = 'none';
		}
	}
	else
	{
		// Firefox Block
		
		if (pSMA010_Id != '')
		{
			document.getElementById(pId).style.cursor = 'pointer';
			cTop = window.pageYOffset + myEvent.clientY;
			cLeft = window.pageXOffset + myEvent.clientX;
			cHeight = screen.availHeight;
			cTopX = cTop + 234;
			if (cTopX > cHeight){cTop = cTop - 134;}
			document.getElementById("divPicture").style.display = '';
			document.getElementById("divPicture").style.top = cTop + 5;
			document.getElementById("divPicture").style.left = cLeft + 5;
			document.getElementById("imgPictureDiv").src = "Tools/FlushFile.aspx?Q1=" + pSMA010_Id + "&Q2=123&Q3=123&Q4=SMA012";
		}
		else
		{
			document.getElementById("divPicture").style.display = 'none';
		}
	}
}

function onMenu(pType,pThis)
{
	if(document.all)
	{
		if (pType == 'Over')
		{
			document.getElementById(pThis).style.cursor = 'pointer';
		}
		else
		{
			document.getElementById(pThis).style.backgroundColor='';
		}
	}
	else
	{
		if (pType == 'Over')
		{
			document.getElementById(pThis).style.cursor = 'pointer';
		}
		else
		{
			document.getElementById(pThis).style.backgroundColor='';
		}
	}
}

function WriteArea(pArea,pValue)
{
	if (document.all)
	{
		document.getElementById(pArea).innerText = document.getElementById(pValue).value;
	}
	else
	{
		//FireFox
		document.getElementById(pArea).value = document.getElementById(pValue).value;
	}
}

function UpDownQuantity(pType,pSHP001_Quantity,pSMA010_MinUnit)
{
	if (document.all)
	{
		if (pType == 'Up')
		{
			document.getElementById(pSHP001_Quantity).innerText = parseFloat(document.getElementById(pSHP001_Quantity).value) + 1;
		}
		else
		{
			if (parseFloat(document.getElementById(pSHP001_Quantity).value) - 1 < parseFloat(document.getElementById(pSMA010_MinUnit).innerText))
			{
				alert('Bu üründen en az ' + document.getElementById(pSMA010_MinUnit).innerText + ' adet sipariş verebilirsiniz.');
			}
			else
			{
				document.getElementById(pSHP001_Quantity).innerText = parseFloat(document.getElementById(pSHP001_Quantity).value) - 1;
			}
		}
	}
	else
	{
		//FireFox
		if (pType == 'Up')
		{
			document.getElementById(pSHP001_Quantity).value = parseFloat(document.getElementById(pSHP001_Quantity).value) + 1;
		}
		else
		{
			if (parseFloat(document.getElementById(pSHP001_Quantity).value) - 1 < parseFloat(document.getElementById(pSMA010_MinUnit).textContent))
			{
				alert('Bu üründen en az ' + document.getElementById(pSMA010_MinUnit).textContent + ' adet sipariş verebilirsiniz.');
			}
			else
			{
				document.getElementById(pSHP001_Quantity).value = parseFloat(document.getElementById(pSHP001_Quantity).value) - 1;
			}
		}
	}
}

function MouseOver(pThis)
{
	if (document.all)
	{
		document.getElementById(pThis).style.cursor = 'hand';
	}
	else
	{
		// Firefox Block
		document.getElementById(pThis).style.cursor = 'pointer';
	}
}

function JumpTab(pTab)
{
	if (pTab == '0')
	{
		document.getElementById('divDetail').style.display = '';
		document.getElementById('divPicture').style.display = 'none';
		document.getElementById('divPay').style.display = 'none';
		
		document.getElementById('labProdDesc').style.fontWeight = 'bolder';
		document.getElementById('labDetaPict').style.fontWeight = '';
		document.getElementById('labPay').style.fontWeight = '';
		
		if (document.all)
		{
			document.getElementById('tbcProdDetail').background = 'Tools/Images/General/TabSelect.jpg';
			document.getElementById('tbcPicture').background = 'Tools/Images/General/TabRight.jpg';
			document.getElementById('tbcPay').background = 'Tools/Images/General/TabRight.jpg';
		}
		else
		{
			//FireFox Block
			document.getElementById('tbcProdDetail').style.background = "url('Tools/Images/General/TabSelect.jpg')";
			document.getElementById('tbcPicture').style.background = "url('Tools/Images/General/TabRight.jpg')";
			document.getElementById('tbcPay').style.background = "url('Tools/Images/General/TabRight.jpg')";
		}
	}
	

	if (pTab == '1')
	{
		document.getElementById('divDetail').style.display = 'none';
		document.getElementById('divPicture').style.display = '';
		document.getElementById('divPay').style.display = 'none';

		document.getElementById('labProdDesc').style.fontWeight = '';
		document.getElementById('labDetaPict').style.fontWeight = 'bolder';
		document.getElementById('labPay').style.fontWeight = '';

		if(document.all)
		{
			document.getElementById('tbcProdDetail').background = 'Tools/Images/General/TabLeft.png';
			document.getElementById('tbcPicture').background = 'Tools/Images/General/TabSelect.png';
			document.getElementById('tbcPay').background = 'Tools/Images/General/TabRight.png';
		}
		else
		{
			//FireFox Block
			document.getElementById('tbcProdDetail').style.background = "url('Tools/Images/General/TabLeft.png')";
			document.getElementById('tbcPicture').style.background = "url('Tools/Images/General/TabSelect.png')";
			document.getElementById('tbcPay').style.background = "url('Tools/Images/General/TabRight.png')";
		}
	}
	
	if (pTab == '2')
	{
		document.getElementById('divDetail').style.display = 'none';
		document.getElementById('divPicture').style.display = 'none';
		document.getElementById('divPay').style.display = '';
		
		document.getElementById('labProdDesc').style.fontWeight = '';
		document.getElementById('labDetaPict').style.fontWeight = '';
		document.getElementById('labPay').style.fontWeight = 'bolder';

		if(document.all)
		{
			document.getElementById('tbcProdDetail').background = 'Tools/Images/General/TabLeft.png';
			document.getElementById('tbcPicture').background = 'Tools/Images/General/TabLeft.png';
			document.getElementById('tbcPay').background = 'Tools/Images/General/TabSelect.png';
		}
		else
		{
			//FireFox Block
			document.getElementById('tbcProdDetail').style.background = "url('Tools/Images/General/TabLeft.png')";
			document.getElementById('tbcPicture').style.background = "url('Tools/Images/General/TabLeft.png')";
			document.getElementById('tbcPay').style.background = "url('Tools/Images/General/TabSelect.png')";
		}

	}
}



function gridOver(mThis,mType)
{
	if (mType == 'blue')
	{
		mThis.style.backgroundColor='#B1CAE0';
	}
	if (mType == 'yellow')
	{
		mThis.style.backgroundColor='#F4EADC';
	}
}

function gridOut(mThis,mType)
{
	if (mType == 0)
	{
		mThis.style.backgroundColor='White';
	}
	if (mType == 1)
	{
		mThis.style.backgroundColor='WhiteSmoke';
	}
	if (mType == 2)
	{
		mThis.style.backgroundColor='#FBFBFB';
	}
}

function QuantityControl(pId,pNewQuantity,pMinQuantity,pOldQuantity,pType)
{
	if (parseFloat(pNewQuantity) < parseFloat(pMinQuantity))
	{
		if (pType == '0')
		{
			alert('Bu üründen sepetinize en az ' + pMinQuantity + ' adet güncelleyebilirsiniz');
		}
		else
		{
			alert('Bu üründen ön sipariş sepetinize en az ' + pMinQuantity + ' adet güncelleyebilirsiniz');
		}
		document.getElementById(pId).value = pOldQuantity;
	}
}

function MsgBox(pPath,pType,pCode,pPar)
{
	var cRet;
	cRet = window.showModalDialog(pPath + '/MsgBox.aspx?Mt=' + pType + '&Mc=' + pCode + '&Mp=' + pPar,'','dialogHeight:247px;dialogWidth:400px;scroll:no;help:no;status:yes');
	
	if (cRet != null)
	{
		return cRet;
	}
	else
	{
		return false;
	}
}

function addCommas(pArea,nStr,nDecFormat)
{
	e = window.event;
	
	if (e.keyCode == 9 || e.keyCode == 16)
	{
		return false;	
	}
	else
	{
		if (nDecFormat.indexOf('.') != "-1")
		{
			nDecSpl = nDecFormat.split('.')
			nDecFormat = nDecSpl[1].length -1
	
			nStrLen = nStr.length;
			nStrLastChar = nStr.substring(nStrLen-1,nStrLen);

			if (nStrLastChar == '0' || nStrLastChar == '1' || nStrLastChar == '2' || nStrLastChar == '3' || nStrLastChar == '4' || nStrLastChar == '5' || nStrLastChar == '6' || nStrLastChar == '7' || nStrLastChar == '8' || nStrLastChar == '9' || nStrLastChar == '-' || nStrLastChar == ',')
			{
				if (nStrLastChar == '-' & nStrLen > 1)
				{
					nStr = nStr.substring(0,nStrLen-1);
				}

				if (nStrLastChar == ',')
				{
					if (nStr.indexOf(',') < nStr.lastIndexOf(','))
					{
						nStr = nStr.substring(0,nStrLen-1);
					}
				}
				
				if (nStr.indexOf(',') == -1)
				{
					nNum = 1;
					if (nStr.substring(0,1) == '-') 
					{ 
						nNum = 2;	
					}
				
					if (nStr.length > nNum & (nStr.substring(0,1) == '0' || nStr.substring(0,2) == '-0'))
					{
						nStr = nStr.substring(0,nStrLen-1);
					}
				}
			}
			else
			{
				nStr = nStr.substring(0,nStrLen-1);
			}	
			nStrLen = nStr.length;
			nNewStr = "";
			
			for (i=0; i <= nStrLen -1; i++)
			{
				nStrChar = nStr.substring(i,i+1);
				if (nStrChar == '0' || nStrChar == '1' || nStrChar == '2' || nStrChar == '3' || nStrChar == '4' || nStrChar == '5' || nStrChar == '6' || nStrChar == '7' || nStrChar == '8' || nStrChar == '9' || nStrChar == '-' || nStrChar == ',')
				{
					nNewStr += nStrChar;
				}
			}
			nStr = nNewStr;
			
			nSing = '';
			if (nStr.substring(0,1) == '-')
			{
				nSing = '-';
				nStr = nStr.substring(1,nStr.length);
			}
			
			x = nStr.split(',');
			x1 = x[0];
			x2 = x[1];
			if (x1 == null || x1 == '')
			{
				if (nStr.indexOf(',') !=  -1)
				{
					x1 = 0;
				}
			}
			
			if (x2 == null)
			{
				nStr = addMyComma(x1);
			}
			else
			{
				nX2Len = x2.length;
				if (nX2Len > nDecFormat)
				{
					nStr = addMyComma(x1) + "," + x2.substring(0,nDecFormat);
				}
				else
				{
					nStr = addMyComma(x1) + "," + x2;
				}
			}
			document.getElementById(pArea).value = nSing + nStr;
		}
		else
		{
			//no decimal
			nStrLen = nStr.length;
			nStrLastChar = nStr.substring(nStrLen-1,nStrLen);
				
			if (nStrLastChar == '0' || nStrLastChar == '1' || nStrLastChar == '2' || nStrLastChar == '3' || nStrLastChar == '4' || nStrLastChar == '5' || nStrLastChar == '6' || nStrLastChar == '7' || nStrLastChar == '8' || nStrLastChar == '9' || nStrLastChar == '-')
			{
				if (nStrLastChar == '-' & nStrLen > 1)
				{
					nStr = nStr.substring(0,nStrLen-1);
				}
				
				nNum = 1;
				if (nStr.substring(0,1) == '-') 
				{ 
					nNum = 2;	
				}
				
				if (nStr.length > nNum & (nStr.substring(0,1) == '0' || nStr.substring(0,2) == '-0'))
				{
					nStr = nStr.substring(0,nStrLen-1);
				}
			}
			else
			{
				nStr = nStr.substring(0,nStrLen-1);
			}
			document.getElementById(pArea).value = nStr;
		}
	}
}

function addMyComma(xStr)
{
	z1 = xStr;
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(z1)) {
		z1 = z1.replace(rgx, '$1' + '.' + '$2');
	}
	return z1;
}

function addReCommas(pArea,nStr,nDecFormat,nMinVal)
{
	if (nDecFormat.indexOf('.') != "-1")
	{
		nDecSpl = nDecFormat.split('.')
		nDecFormat = nDecSpl[1].length -1

		nSing = '';
		
		if (nStr.substring(0,1) == '-')
		{
			nSing = '-';
			nStr = nStr.substring(1,nStr.length);
		}

		x = nStr.split(',');
		x1 = x[0];
		if (x1 == null || x1 == '')
		{
			if(nMinVal == null || nMinVal == '')
			{
				nMinVal = 0;
			}
			x1 = nMinVal;
		}
	
		x2 = x[1];
		if (x2 == null)
		{
			nStr = x1 + ",";
			for (i=0 ; i<= nDecFormat -1;i++)
			{
				nStr += "0";
			}
		}
		else
		{
			nX2Len = x2.length;
			
			if (nX2Len < nDecFormat)
			{
				nStr = x1 + "," + x2;
				
				for (i=0 ; i<= nDecFormat - nX2Len-1; i++)
				{
					nStr += "0";
				}
			}
		}
		document.getElementById(pArea).value = nSing + nStr;
	}
	else
	{
		//no Decimal
		if (nStr == null || nStr == '' || nStr == '-')
		{
			if (nMinVal == null || nMinVal == '')
			{
				nMinVal = 0;
			}
			nStr = nMinVal;
		}
		else
		{
			if (parseInt(nStr) < parseInt(nMinVal))
			{
				nStr = nMinVal;
			}			
		}
		document.getElementById(pArea).value = nStr;
	}
}

function GoLink(pPar)
{
	var pVal = pPar.split("~");
	var mPath;
	
	mPath = "";

	switch (pVal[0])
	{
		case "0" :
			document.location = mPath + "Main.aspx";
			break;
		case "1" :
			if (pVal[4] == '0')
			{
				document.location = 'http://' + pVal[1];
			}
			else
			{
				window.open('http://' + pVal[1],'','scrollbars=yes,status=no,resizable=no,toolbar=no,menubar=no,location=no,width=' + pVal[6] + ',height=' + pVal[5] + ',titlebar=no');
			}
			break;
		case "2" :
			if (pVal[4] == '0')
			{
				document.location = 'https://' + pVal[1];
			}
			else
			{
				window.open('https://' + pVal[1],'','scrollbars=yes,status=no,resizable=no,toolbar=no,menubar=no,location=no,width=' + pVal[6] + ',height=' + pVal[5] + ',titlebar=no');
			}
			break;
		case "3" :
			if (pVal[4] == '0')
			{
				document.location = 'ftp://' + pVal[1];
			}
			else
			{
				window.open('ftp://' + pVal[1],'','scrollbars=yes,status=no,resizable=no,toolbar=no,menubar=no,location=no,width=' + pVal[6] + ',height=' + pVal[5] + ',titlebar=no');
			}
			break;
		case "4" :
			if (pVal[4] == '0')
			{
				document.location = 'news://' + pVal[1];
			}
			else
			{
				window.open('news://' + pVal[1],'','scrollbars=yes,status=no,resizable=no,toolbar=no,menubar=no,location=no,width=' + pVal[6] + ',height=' + pVal[5] + ',titlebar=no');
			}
			break;
		case "5" :
			document.location = 'mailto://' + pVal[1];
			break;
		case "6" :
			if (pVal[2] != "")
			{
				if (pVal[2] == "1")
				{
					document.location = mPath + "ProductDetail.aspx?Q1=" + pVal[3];
				}
			}
			else
			{
				document.location = mPath + "ProductDetail.aspx?Q1=" + pVal[1];;
			}
			break;
		case "8" :
			if (pVal[4] == '0')
			{
				document.location = mPath + 'Tools/FlushFile.aspx?Q1=' + pVal[1] + '&Q2=1000&&Q3=1000&Q4=ARC001';
			}
			else
			{
				window.open(mPath + 'Tools/FlushFile.aspx?Q1=' + pVal[1] + '&Q2=1000&&Q3=1000&Q4=ARC001','','scrollbars=yes,status=no,resizable=no,toolbar=no,menubar=no,location=no,width=' + pVal[6] + ',height=' + pVal[5] + ',titlebar=no');
			}
			break;
		case "9" :
			if (pVal[4] == '0')
			{
				document.location = mPath + "Document.aspx?Q1=" + pVal[1] + "&Q2=A";
			}
			else
			{
				window.open(mPath + 'Document.aspx?Q1=' + pVal[1] + '&Q2=A','','scrollbars=yes,status=no,resizable=no,toolbar=no,menubar=no,location=no,width=' + pVal[6] + ',height=' + pVal[5] + ',titlebar=no');
			}
			break;
		case "11" :
			document.location = mPath + "Categories.aspx?Q1=" + pVal[1];
			break;
	}
	
}

function onMouse(pThis,pColor)
{
	pThis.style.color = pColor;
}

function ShowLoading(pType,myEvent)
{
	if(document.all)
	{
		if (pType == 'Show')
		{
			cTop = document.body.scrollTop + event.y;
			cLeft = document.body.scrollLeft + event.x;
			cHeight = screen.availHeight;
			cWidth = screen.availWidth;
			if (cHeight < cTop + 140)
			{
				cTop = cTop - 140;
			}		
			if (cWidth < cLeft + 200)
			{
				cLeft = cLeft - 200;
			}	
			document.getElementById("divMessage").style.top = cTop;
			document.getElementById("divMessage").style.left = cLeft;
			document.getElementById("divMessage").style.display = '';
		}
		else
		{
			document.getElementById("divMessage").style.display = 'none';
		}
	}
	else
	{
		// FireFox Block
		if (pType == 'Show')
		{
			cTop = window.pageYOffset + myEvent.clientY;
			cLeft = window.pageXOffset + myEvent.clientX;
			cHeight = screen.availWidth;
			cWidth = screen.availWidth;
			if (cHeight < cTop + 140)
			{
				cTop = cTop - 140;
			}		
			if (cWidth < cLeft + 200)
			{
				cLeft = cLeft - 200;
			}	
			document.getElementById("divMessage").style.top = cTop;
			document.getElementById("divMessage").style.left = cLeft;
			document.getElementById("divMessage").style.display = '';
		}
		else
		{
			document.getElementById("divMessage").style.display = 'none';
		}
	}
}



