
document.oncontextmenu=new Function ("return false");
/* ---------------------------- */

/* XMLHTTPRequest Enable */

/* ---------------------------- */

function createObject() {

var request_type;

var browser = navigator.appName;

if(browser == "Microsoft Internet Explorer"){

request_type = new ActiveXObject("Microsoft.XMLHTTP");

}else{

request_type = new XMLHttpRequest();

}

return request_type;

}



var http = createObject();







/* -------------------------- */

/* LOGIN */

/* -------------------------- */

/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */

var nocache = 0;

function login() {

// Optional: Show a waiting message in the layer with ID ajax_response

document.getElementById('login_response').innerHTML = "Loading......";

// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.

var uname = encodeURI(document.getElementById('uname').value);

var uid = encodeURI(document.getElementById('uid').value);

var pass = encodeURI(document.getElementById('pass').value);

if(uname=="" )

	{

	document.getElementById('login_response').innerHTML = '<font color="#3366FF"><b>Please Enter User Name</b></font>';	

	}

else if(uid=="" )

	{

	document.getElementById('login_response').innerHTML = '<font color="#3366FF"><b>Please Enter User ID</b></font>';	

	}

else if(pass=="" )

	{

	document.getElementById('login_response').innerHTML = '<font color="#3366FF"><b>Please Enter Password</b></font>';	

	}

else

	{

	

// Set te random number to add to URL request

nocache = Math.random();

// Pass the login variables like URL variable

http.open('get','login.php?uname='+uname+'&uid='+uid+'&pass='+pass+'&nocache='+nocache);

http.onreadystatechange = loginReply;

http.send(null);

}

}



function loginReply()



{

	if(http.readyState == 4)

	{ 

		var response = http.responseText;

		//alert(response);

		if(response == '0')

		{

		// if login fails

		//document.getElementById('login_response').innerHTML = 'Wel'+response;

		document.getElementById('login_response').innerHTML = '<font color="#CC0000"><b>Login failed! Verify User Name, User ID  and password</b></font>';

		// else if login is ok show a message: "Welcome + the user name".

		}

		else

		{

			alert('Welcome to O-I-SYS');

			location.href="home.php";

		}

	}

	//exit();

}

	




function findPos(obj){
    var curleft = curtop = 0;
    if (obj.offsetParent){
        curleft = obj.offsetLeft;
        curtop = obj.offsetTop;
        while (obj = obj.offsetParent){
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        }
    }
    return [curleft,curtop];
}




//------------------------------------------------------------------------------------------------------------

function showdetails(id)

	{
	
	if(id=="inf_comm_fac")
	{
		document.getElementById('shodetails').style.height = '4500px';
	}
	else if(id=="pro_plo_all")
	{
		document.getElementById('shodetails').style.height = '1550px';
	}
	else if(id=="bre_des_sagar_neer")
	{
		document.getElementById('shodetails').style.height = '2800px';
	}
	else
	{
		document.getElementById('shodetails').style.height = '700px';
	}
	
	
	
	
	document.getElementById('shodetails').src = 'showdetails.php?id='+id;
 	
	window.scrollTo(0,700);
	}

//--------------------------------------------------------------------------------------------------------------------------

function showdetailsReply()



{

	if(http.readyState == 4)

	{ 

		var response = http.responseText;

		document.getElementById('showdetails').focus();
		document.getElementById('showdetails').innerHTML = response;
				
		window.scrollTo(0,700);
			

	}

	

}

