function displayError(errormessage, textarea, messagearea) {
	try 
	{
		document.getElementById(messagearea).innerHTML = "&nbsp;"+errormessage;
		document.getElementById(textarea).className = "errorinput";	
	}
	catch(e) { alert(e); }
}

function resetError(textarea, messagearea) {
	try
	{
		document.getElementById(messagearea).innerHTML = "";
		document.getElementById(textarea).className = "input";
	}
	catch(e) { alert(e); }
}
//function loadLang() {
    //document.getElementById('language_script').innerHTML = '<br /><a href="index.aspx?id=Hindi" ><img src="images/flags/india.png" alt="Hindi"/></a><a href="index.aspx?id=Chinese" ><img src="images/flags/China.png" alt="China"/></a><a href="index.aspx?id=USEnglish" ><img src="images/flags/United States of America (USA).png" alt="USA"/></a><a href="index.aspx?id=Russian" ><img src="images/flags/Russian Federation.png" alt="RSA"/></a><a href="index.aspx?id=France" ><img src="images/flags/France.png" alt="France"/></a><a href="index.aspx?id=Spain" ><img src="images/flags/Spain.png" alt="Japan"/></a>'
//}
//window.onload = loadLang;
function removeText(text,id) {
	if(document.getElementById(id).value == text) {
		document.getElementById(id).value = '';
		document.getElementById(id).style.color = "#000";
	}
}
			
function addText(text,id) {
	if(document.getElementById(id).value == '' || document.getElementById(id).value == text) {
		document.getElementById(id).value = text;
		document.getElementById(id).style.color = "#999";
	}
}
function addLoginText(text, id) {

    if (document.getElementById(id).value == '' || document.getElementById(id).value == text) {
        document.getElementById(id).value = text;
        document.getElementById(id).style.color = "#999";
    }
}
function removeLoginText(text, id) {

    if (document.getElementById(id).value == text) {
        document.getElementById(id).value = '';
        document.getElementById(id).style.color = "#000";
    }
}
function hidediv(hide,show) {
    document.getElementById(hide).style.visibility = 'hidden';
    document.getElementById(show).style.visibility = 'visible';
}
function blockdiv(id) {
    document.getElementById(id).style.display = 'none';
}
function displaydiv(id) {
    document.getElementById(id).style.display = 'block';
}

//function displaydiv(id) {
//    document.getElementById(id).style.display = 'block';
////    document.getElementById(id).style.width = size;  
//    
//}
function usrActionReg(which,action) {
      if (action == 'print') {
		 /* var sOption="toolbar=no,location=no,directories=no,menubar=no,"; 
       sOption+="scrollbars=no,width=1,height=1,left=100,top=25"; 

	   var sWinHTML = document.getElementById('left').innerHTML; 
   
   		var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html><link href="../../192.168.0.102/dharmdiam/include/css/print.css" media="print" rel="stylesheet" type="text/css" /><body>'); 
       winprint.document.write(sWinHTML);          
       winprint.document.write('</body></html>'); 
	   //winprint.print();
       //winprint.close(); 
//       winprint.focus(); 
//     window.print (); */
		window.print ();
      }
      else if (action == 'email') {
		bodystring = '<table width="655" border="0" align="center" cellpadding="0" cellspacing="0" style="border:#E1C154 1px solid;"><tr><td  style=" background-color: #EDE6CC;"><table width="655" cellpadding="0" cellspacing="0" border="0"><tr><td width="15" height="75" bgcolor="#FFFFFF"></td><td width="600" height="75" bgcolor="#FFFFFF"><img src="../../www.dharmanandan.com/images/logo.jpg" border="0" alt="Dharmanandan"></td><td width="40" height="75" bgcolor="#FFFFFF"></td></tr><tr><td colspan="3" height="5" style="background-color: #B79520;"></td></tr><tr><td colspan="3" height="1" style="background-color: #E1C154;"></td></tr></table><table width="655" cellpadding="0" cellspacing="0" border="0" style="style="font-size: 10px; color: #000000; font-family: verdana; line-height:13px;""><tr><td>&nbsp;</td><td >&nbsp;</td><td>&nbsp;</td></tr><tr><td width="15"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td><td width="620" style="font-size: 10pt; color: #000000;font-family: verdana;line-height:13pt;">Please visit this link '+encodeURIComponent(location.href)+'</td> <td width="20"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td></tr><tr><td width="15"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td><td width="620" style="font-size: 10pt; color: #000000;font-family: verdana;line-height:13pt;"><p align="justify"><br /><a href="../../www.dharmanandan.com/default.htm" target="_blank" style="font-size: 10pt; color: #B79520; font-family: verdana; text-decoration:underline; font-weight:bold;">Dharmanandan Diamonds Pvt. Ltd.</a> is a quality passionate and customer centric <strong>company</strong> offering <strong>myriad</strong> of products with <strong>impeccable</strong> quality. You have allied your self with one of the leading India & Belgium based Diamond manufacturers, importers & exporters.</p><p><strong>Why Dharmanandan Diamonds?</strong></p><ul style="line-height:1.8em;"><li>Simply because of the policy of long term business relationship by never compromising with the quality they offer and continuous improvement in the quality at every phase of the business process.</li><li>Understanding covets and concerns of the customer and catering consequently.</li><li>The team of professionally qualified managers and expert employees having perfect craftsmanship for diamond polishing under the guidance of experienced Directors looks after the client&rsquo;s satisfaction.</li><li>Dharmanandan has thus become the first choice of the diamond centric customers by providing excellent quality products at right prices. </li></ul><center><font size="3"><strong><i>Shaping a better Tomorrow</i></strong></font></center><p><strong>Our real diamonds are customers who inspire and we perspire.</strong></p><p><br /><strong><u>Dharmanadans Achievements.</u></strong><br /><a href="../../www.dharmanandan.com/default.htm" target="_blank" style="font-size: 10pt; color: #B79520; font-family: verdana;text-decoration:underline;font-weight:bold;">GJEPC Annual Award 2007,</a><br/><a href="../../www.dharmanandan.com/default.htm" target="_blank" style="font-size: 10pt; color: #B79520;font-family: verdana; text-decoration:underline;font-weight:bold;">FIEO "Niryat Shree" Gold Trophy - 2002-03, 2003-04, 2004-05. </a> </p><p><br>Sincerely, <br>Mr. Haresh<br>Customer Service Manager<br><br><br></p></td><td width="20"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td></tr></table><table width="655" cellpadding="0" cellspacing="0" border="0"><tr><td width="655" style="background-color:#E1C154;" height="1"></td></tr><tr><td><table width="655" cellpadding="0" cellspacing="0" border="0"><tr><td width="10"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td><td width="250" style="font-size: 10px; color: #B79520; LINE-HEIGHT: 13px; font-family: verdana;"><br><b>Mr. Haresh</b><br>Customer Service Manager<br><br><nobr><b>EMAIL : </b><a href="mailto:info_40dharmanandan.com">sales@dharmanandan.com</a></nobr><br><b>TEL : </b>+91.22.4004 1111 / 2 /3 / 4 / 5<br><b>FAX : +</b>91.22.6635 5533<br><br></td><td width="1" background="../../www.dharmanandan.com/html/images/lcemaildot.gif"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td><td width="10"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td><td width="405" valign="top" style="font-size: 10px;color: #B79520; LINE-HEIGHT: 13px; font-family: verdana;"><br>This email message is confidential, intended only for the named recipient(s) above, and may contain information that is privileged, Diamond work  product, or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender at  <span style="font-size: 10px; color: #B79520; LINE-HEIGHT: 13px; font-family: verdana;">+91.22.4004 1111</span> and delete this email message from your computer. Thank you.<br><br></td><td width="10"><img src="../../www.dharmanandan.com/images/spacer.gif" width="1" height="1" border="0"></td></tr></table></td></tr><tr><td width="655" style="background-color: #E1C154;" height="1"></td></tr></table><table width="655" cellpadding="0" cellspacing="0" border="0"><tr>  <td height="2"></td></tr><tr><td height="30" style="font-size: 10px; color: #B79520; LINE-HEIGHT: 13px; font-family: verdana;" align="center" valign="middle">&copy; 2008 DHARMANANDAN. All Rights Reserved.  Office: G/14, Prasad Chambers,Opera House, Mumbai (India)</td></tr></table></td> </tr></table>';
		
      	location.href='mailto:?subject='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(location.href);
      }
}
function DetailRecord(id, script) {
	location.href=script+"&cert_id="+id;	
	return false;
}

	//###--->>> Numeric Validation for Input DATA

	function isNumeric(formName,eleName,errorId,errorMsg)
	{
		//--->>> Checking If Blank
		if(eval('document.'+formName+'.'+eleName+'.value') != "") {
			
			//--->>> Checking if Element value if not numeric
			if(isNaN(eval('document.'+formName+'.'+eleName+'.value'))) {

				document.getElementById(errorId).innerHTML = errorMsg;
				return false;
			}
			else
				document.getElementById(errorId).innerHTML = '';	
		}
		return true;
	}
	
	//###--->>> Erase All Cookies of Browser that store Grid's Checkbox status ::: It will call at whern LOGOUT
	function eraseAllCookie()
	{
		try	{
			//--->>> Taking All Cookies in Cookies as treated as Variable
			var Cookies = document.cookie.split(";");
			
			//--->>> Getting Each Cookies
			for ( var Cnt=0; Cnt < Cookies.length; Cnt++ ) {
				var CurCookie = Cookies[Cnt].split("=");
				if ( CurCookie[0] ) {
					if(CurCookie[0].substring(1,3) == 'c_') {
						document.cookie = CurCookie[0]+"="+0+"; path=/"; //this.set(CurCookie[0].replace(/^\s*|\s*$/g,""), "", -1)
					}
				};
			}
		}
		catch(e) { 
			alert(e); 
		}
	}
	
	//###--->>> Character Validation for Input DATA

	function isCharacter(formName,eleName,errorId,errorMsg)
	{
		//--->>> Checking If Blank
		if(eval('document.'+formName+'.'+eleName+'.value') != "") {
			
			//--->>> Checking if Element value if not numeric
			if(!isNaN(eval('document.'+formName+'.'+eleName+'.value'))) {
				//eval('document.'+formName+'.'+eleName+'.value=""');
				//eval('document.'+formName+'.'+eleName+'.focus()');
				document.getElementById(errorId).innerHTML = errorMsg;
				return false;
			}
			else
				document.getElementById(errorId).innerHTML = '';	
		}
		return true;
}
function Display_Carat(sender,args) {
    var Lft = parseInt(document.getElementById('Master1_ContentPlaceHolder1_Crt_Left').value);
    var Rht = parseInt(document.getElementById('Master1_ContentPlaceHolder1_Crt_Right').value);
    document.getElementById('Master1_ContentPlaceHolder1_LblCrt').innerHTML = 'Carat Size : ' + Math.round(SetCarat(Lft) * 100) / 100 + ' to ' + Math.round(SetCarat(Rht) * 100) / 100;
}
function Display_Carat() {
    var Lft = parseInt(document.getElementById('Master1_ContentPlaceHolder1_Crt_Left').value);
    var Rht = parseInt(document.getElementById('Master1_ContentPlaceHolder1_Crt_Right').value);
    document.getElementById('Master1_ContentPlaceHolder1_LblCrt').innerHTML = 'Carat Size : ' + Math.round(SetCarat(Lft) * 100) / 100 + ' to ' + Math.round(SetCarat(Rht) * 100) / 100;
}

function SetCarat(Wt) {
    switch (true) {
        case parseInt(Wt) >= 0 && parseInt(Wt) <= 20:
            return 0.30 + parseInt(Wt) * 0.01;
            break;
        case parseInt(Wt) >= 21 && parseInt(Wt) <= 30:
            return 0.5 + (parseInt(Wt) - 20) * 0.02;
            break;
        case parseInt(Wt) >= 31 && parseInt(Wt) <= 60:
            return 0.7 + (parseInt(Wt) - 30) * 0.01;
            break;
        case parseInt(Wt) >= 61 && parseInt(Wt) <= 70:
            return 1.0 + (parseInt(Wt) - 60) * 0.02;
            break;
        case parseInt(Wt) >= 71 && parseInt(Wt) <= 80:
            return 1.2 + (parseInt(Wt) - 70) * 0.03;
            break;
        case parseInt(Wt) >= 81 && parseInt(Wt) <= 90:
            return 1.5 + (parseInt(Wt) - 80) * 0.02;
            break;
        case parseInt(Wt) >= 91 && parseInt(Wt) <= 100:
            return 1.7 + (parseInt(Wt) - 90) * 0.03;
            break;
        case parseInt(Wt) >= 101 && parseInt(Wt) <= 110:
            return 2.0 + (parseInt(Wt) - 100) * 0.025;
            break;
        case parseInt(Wt) >= 111 && parseInt(Wt) <= 120:
            return 2.25 + (parseInt(Wt) - 110) * 0.026;
            break;
        case parseInt(Wt) >= 121 && parseInt(Wt) <= 130:
            return 2.51 + (parseInt(Wt) - 120) * 0.049;
            break;
        case parseInt(Wt) >= 131 && parseInt(Wt) <= 160:
            return 3.0 + (parseInt(Wt) - 130) * 0.1;
            break;
        case parseInt(Wt) >= 161 && parseInt(Wt) <= 170:
            return 6.0 + (parseInt(Wt) - 160) * 1;
            break;
    }

}

