<!--
if (!document.layers&&!document.all&&!document.getElementById)
event="test";
function showtip(current,e,text){

if (document.all||document.getElementById){
thetitle=text.split('<br>');
if (thetitle.length>1){
thetitles='';
for (i=0;i<thetitle.length;i++)
thetitles+=thetitle[i];
current.title=thetitles;
}
else
current.title=text;
}

else if (document.layers){
document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>');
document.tooltip.document.close();
document.tooltip.left=e.pageX+5;
document.tooltip.top=e.pageY+5 ;
document.tooltip.visibility="show";
}
}
function hidetip(){
if (document.layers)
document.tooltip.visibility="hidden" ;
}



function resolvePopup(action,contextPath,maincatalogue,lang, newlink)
{
	var windowName = '';
	var windowWidth	= '';
	var windowHeight = '';
	var windowUrl ='';

	if(action == 'productTables')
	{
		windowName = 'tabWindow';
		windowWidth	= '550';
	    windowHeight = '580';
		windowUrl ='jsp/extra/productTablesList.jsp?';
	}
	else if (action == 'calculations') {
		windowName = '';
		windowWidth	= '500';
	    windowHeight = '500';
		windowUrl ='jsp/calculation/calculationIndex.jsp?';
	}
	else  if (action == 'cad'){
		windowName = '';
		windowWidth	= '550';
	    windowHeight = '400';
		windowUrl ='jsp/search/searchDesignationForm.jsp?newlink='+newlink+'&action='+action;
	}
	else {
		windowName = '';
		windowWidth	= '550';
	    windowHeight = '400';
		windowUrl ='calculationsFilter?newlink='+newlink+'&action='+action;
	}
	openPopup(maincatalogue,lang, windowName, windowWidth, windowHeight, contextPath+windowUrl);
}

function openPopup(maincatalogue, lang, windowName, windowWidth, windowHeight, windowUrl, pafurl){

	windowUrl = windowUrl + "&maincatalogue="+maincatalogue+"&lang="+lang+"&pafurl="+pafurl;
	newWindow = window.open(windowUrl, windowName, "screenX=10,screenY=10,top=10,left=10,width="+windowWidth+",height="+windowHeight+",scrollbars=yes,resizable=yes");
	newWindow.focus();
}

function openPopup(maincatalogue, lang, windowName, windowWidth, windowHeight, windowUrl){
	newWindow = window.open(windowUrl+ "&maincatalogue="+maincatalogue+"&lang="+lang, windowName, "screenX=10,screenY=10,top=10,left=10,width="+windowWidth+",height="+windowHeight+",scrollbars=yes,resizable=yes");
	newWindow.focus();
}

var cookiesEnabled = checkCookies();
function imageViewer(maincatalogue, lang, windowName, windowWidth, windowHeight, contextPath, jspName, queryString){
	if(cookiesEnabled)
		windowUrl = contextPath +"jsp/viewers/imageViewerJs.jsp?"+queryString;
	else
		windowUrl = jspName+"?"+queryString;

	openPopup(maincatalogue, lang, 'IMAGES', windowWidth, windowHeight, windowUrl);

}


function searchDesignation(maincatalogue, lang, url, designation){
	      var help = designation ;
	      //help = replace(help, "-", "uuu");
	      //help = replace(help, "+", "vvv");
	      sr=window.open(url+"&lang="+lang+"&maincatalogue="+maincatalogue+"&designationField="+escape(help),"","screenX=10,screenY=10,top=10,left=10,width=400,height=400,scrollbars=yes,resizable=yes")
}

function langChanged(query){
	newlang=document.langform.lang.options[document.langform.lang.selectedIndex].value;
	if(newlang != null && newlang.length>0)
         document.location.href = query+newlang;
}

// link for video
function video(context_path,page,_w,_h,lang,maincatalogue){
	var h =_h -0;
	h = h+100;
	var w =_w -0;
	w = w+40;
    vi=window.open(context_path+ "jsp/viewers/videoViewer.jsp?file="+page+"&maincatalogue="+maincatalogue+"&lang="+lang,"Video", "width="+w+",height="+h+",screenX=10,screenY=10,top=10,left=10,alwaysRaised=yes,toolbar=no,resizable=no")
    vi.focus();
}

// link for demos and anim
function demo(context_path,page,_w,_h,lang,maincatalogue){
	var h =_h -0;
	h = h+100;
	var w =_w -0;
	w = w+40;
    de=window.open(context_path+ "jsp/viewers/demoViewer.jsp?file="+page+"&maincatalogue="+maincatalogue+"&lang="+lang,"", "width="+w+",height="+h+",screenX=10,screenY=10,top=10,left=10,alwaysRaised=yes,toolbar=no,resizable=no")
    de.focus();
}


//function openpage(pafurl,link) {
function openpage(pafurl,link,lang) {
    //opener.location.href=pafurl+"newlink="+link ;
    location.href=unescape(pafurl)+"newlink="+link+"&lang="+lang;
	window.focus();
}
function openExtrapage(context_path, maincatalogue, lang, extrafile) {
        openPopup( maincatalogue, lang ,'','600','500',context_path +'jsp/extra/popXml.jsp?extrafile='+extrafile);
}

function openPopupWindowWithBar(url,name,properties){
	printingpage =  window.open(url, name, properties);
}



/*new for reusing clac result
function calculation(context_path,action,maincatalogue, newlink,lang,pafurl,parentWindow,session) {
		calw=window.open(context_path +"servlet/childCalculationSetter;jsessionid="+session+"?parentWindow="+parentWindow+"&action="+action+"&newlink="+newlink+"&lang="+lang+"&maincatalogue="+maincatalogue,"","screenX=10,screenY=10,top=10,left=10,width=600,height=600,scrollbars=yes,resizable=yes,status=yes,location=yes");
	calw.focus();
}
*/


function set(What,Value) {
//alert(What + '\n' + Value);
    if (document.layers && document.layers[What] != null){
		// document.layers[What].visibility = Value;
    //if (document.layers){
	    if(Value == 'visible')
	        document.layers[What].visibility = 'show';
	    else
	    	document.layers[What].visibility = 'hide';
		
		//document.layers[What].visibility = Value;

    }else if (document.all) eval('document.all.'+What+'.style.visibility ="'+ Value+'"');
	else if (document.getElementById){
		var obj = document.getElementById(What);
		obj.style.visibility=Value;
	}
}


function clicked(Form,Radio,Layer) {
    for (var i=0; i<Form[Radio].length; i++) {
        if (Form[Radio][i].checked) 
			set(Layer,Form[Radio][i].value);
    }
}




function replace(string,text,by) {
// Replaces text with by in string
   // alert(string);
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

   // alert(newstr);
    return newstr;
}



function mouseover(row,rnum){
		row.style.color='#ffffff';
		row.style.backgroundColor='#003399';
		if (document.getElementById){ // browser supports DOM access
			var myrow = document.getElementById(rnum).getElementsByTagName("td");
			var max = myrow.length;
			for(var i = 0;i < max;i++){
				  var nodeObj = myrow.item(i);
				  nodeObj.style.color = '#ffffff';
			}
		}

}

function mouseout(row,rnum,bg){
		row.style.color='#000000';
		row.style.backgroundColor=bg;
		if (document.getElementById){ // browser supports DOM access
			var myrow = document.getElementById(rnum).getElementsByTagName("td");
			var max = myrow.length;
			for(var i = 0;i < max;i++){
				  var nodeObj = myrow.item(i);
				  nodeObj.style.color = '#000000';
			}
		}

}

function validate(what) {
	/*
   var valid = true;
    for (var i=0, j=what.elements.length; i<j && valid; i++) {
        myName = what.elements[i].name;
        if ((myName.indexOf('Select') == -1) && (myName.indexOf('Radio') == -1) && 
			(myName.indexOf('next') == -1) && (myName.indexOf('calc') == -1) && 
			(myName.indexOf('newlink') == -1 && (myName.indexOf('action') == -1) && (myName.indexOf('windownick') == -1)))
            if (what.elements[i].value == ''){
				alert("invalid "+myName);
				valid = false;
			}
		    else
		    	valid = checkNumeric(what.elements[i].value);
	}

   if (!valid) {
     //  what.elements[i-1].focus();
	   return false;
   }else{
	   return true;
   }
   */
	return true;
}

function checkNumeric(objName){
		 //alert(objName);
		var checkOK = "0123456789";
		var checkStr = objName;
		var allValid = true;
		var decPoints = 0;
		for (i = 0;  i < checkStr.length;  i++)
		{
				ch = checkStr.charAt(i);
				for (j = 0;  j < checkOK.length;  j++)
					   if (ch == checkOK.charAt(j))
						  break;
					   else if( ch == '.'){
						   decPoints ++;
						   break
					   }
				if (j == checkOK.length || decPoints>1)
				{
					alert("non numeric input!!!");
					alert(checkStr);
					allValid = false;
					break;
				}
		}
		    
		return  allValid;
		
}

function arrtype_alert(){
        if(document.form1.l4.selectedIndex == 3  && document.form1.l5.selectedIndex == 2) 
              alert('This combination arrangement/type is not valid');
}

function housingsvalidate(what) {
   var valid = true;
   if(what.l4.selectedIndex == 0 && what.des.value.length == 0)
	   valid = false;
   else if(what.l1.selectedIndex == 0   ||  what.l5.selectedIndex == 0  || what.l3.selectedIndex == 0 || what.l6.selectedIndex == 0 )
			 valid = false;
   else{

		  valid = checkNumeric(what.diamin.value) &&  checkNumeric(what.diamax.value) ;
   }

   if (!valid) {
     //  what.elements[i-1].focus();
	   return false;
   }else{
	   return true;
   }
}

function housingsSelection(context_path,lang,session) {
    alert("Temporarly disabled");
	//t=window.open(context_path+"calculation/housingsTransformer.jsp;jsessionid="+session+"?action=HousingsSelection&lang="+lang ,"","screenX=10,screenY=10,top=10,left=10,width=400,height=600,scrollbars=yes,resizable=yes")
    //t.focus();
}


function checkCookies(){
	cookie_set = false;
	Set_Cookie( 'test', 'none', '', '/', '', '' );
	if ( Get_Cookie( 'test' ) )
	{
		cookie_set = true;
		Delete_Cookie('test', '/', '');
	}
	return  cookie_set;
}
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{ return null;}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires )
	{
		 expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
					( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
					( ( path ) ? ";path=" + path : "" ) + 
					( ( domain ) ? ";domain=" + domain : "" ) +
					( ( secure ) ? ";secure" : "" );
}
			
			


//-->


