// use in index page body...
function hot1()
{
document.getElementById("tab1").className="h_tbn4";
document.getElementById("tab2").className="h_tbn5";
document.getElementById("fps").className="f_bgn2";
document.getElementById("hps").className="hot_bg2";

}

function hot2()
{
document.getElementById("tab1").className="h_tbn5";
document.getElementById("tab2").className="h_tbn4";
document.getElementById("fps").className="f_bgn1";
document.getElementById("hps").className="hot_bg1";
}

function runnew()
{
	ow=screen.width;
	if (ow >= 1024)
	{

		document.getElementById('resonew').className="h_born1new";
					document.getElementById('services').className="h_ser1";

	}


		if (ow <= 800)
	{
			document.getElementById('resonew').className="h_born1new1";
			document.getElementById('services').className="h_ser2";

	}
}
// End


//use for all images resizing...
function resize_hw(Obj, h, w)
{
	myImage = new Image();
// 	myImage.src = image;
	myImage.src = Obj.src;
	var height = myImage.height;
	var width  = myImage.width;


	if(height > h || width > w)
	{
		if(height > width)
		{
			var temp = height/h;

			var new_width = width / temp;
			new_width = parseInt(new_width);

			height = h;
			width = new_width;
		}
		else
		{
			var temp = width/w;

			var new_height = height / temp;
			new_height = parseInt(new_height);

			height = new_height;
			width = w;
		}
	}
	Obj.height = height;
	Obj.width = width;
}


function resize(Obj, image)
{
	myImage = new Image();
	myImage.src = image;
	var height = myImage.height;
	var width  = myImage.width;

	if(height > 100 || width > 100)
	{
		if(height > width)
		{
			var temp = height/100;

			var new_width = width / temp;
			new_width = parseInt(new_width);

			height = 100;
			width = new_width;
		}
		else
		{
			var temp = width/100;

			var new_height = height / temp;
			new_height = parseInt(new_height);

			height = new_height;
			width = 100;
		}
	}

	Obj.height = height;
	Obj.width = width;
}
//end of image resizing



//for search page....
function CheckDataSearch(Form)
{
	var str='';
	Form.ss.value = Form.ss.value.replace(/^\s+/g, '').replace(/\s+$/g, '');
	if (Form.ss.value.length < 3)
	{
		alert("Enter at least three characters for search.");
		Form.ss.focus();
		return false;
	}
	else
	{
		if(Form.searchfor.value == "comp")
                {
			str +='ss='+escape(Form.ss.value);
			//str += '&searchfor='+Form.searchfor.value;
			//str += '&modid=DIR';

			str = "http://dir.indiamart.com/cgi/compcatsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");

			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "product")
                {
			str +='ss='+escape(Form.ss.value);
			//str += '&searchfor='+Form.searchfor.value;
			//str +='&modid=CTL';

			str = "http://catalogs.indiamart.com/cgi/catprdsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");

			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "offer")
                {
			str +='search='+escape(Form.ss.value);
			//str += '&searchfor='+Form.searchfor.value;
			//str +='&modid=ETO';
			
			str = "http://trade.indiamart.com/search.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");

			window.location = str;
			return false;
                }
		else if(Form.searchfor.value == "tenders")
		{
			str +='ss='+escape(Form.ss.value);
			str += '&searchfor='+Form.searchfor.value;
			str +='&modid=TDR';
			str +='&cr=td';
			str +='&sr=1';

			str = "http://tenders.indiamart.com/tenders-search.pl?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");

			window.location = str;
			return false;
		}
	}
}

function myReplace(str, a, b) {
	var re = new RegExp(a, "g");
	var ret = str.replace(re,b);
	return ret;
}
//end of serach


//for login check...
function Check_Login()
{

	if(document.loginform.usr_name.value == "" ) {
	alert("Kindly enter your User Name/E-mail ID.");
	document.loginform.usr_name.focus();
	return false;
	}
	else if(document.loginform.usr_name.value.length < 4) {
	alert("The User Name should be atleast 4 characters long.");
	document.loginform.usr_name.focus();
	return false;
	}
	else if(document.loginform.usr_pass.value == "" ) {
	alert("Kindly enter your Password.");
	document.loginform.usr_pass.focus();
	return false;
	}
	else if(document.loginform.usr_pass.value.length < 4) {
	alert("The Password should be atleast 4 characters long.");
	document.loginform.usr_pass.focus();
	return false;
	}
	else {
	return true;
	}

}
//end of login check

//email validations
function validateit(theForm)
{
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		theForm.email.focus();
		return (false);
	}
}

function getblank(this1)  {
	if (this1.value = "Your Email Here.") {
		this1.value = "";
	}
    return true;
}
//end of email


//use in newsletter
function openchild_nl(thisurl)
{
	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
	if (condition == true  )
		CanAnimate = true;
	else
		CanAnimate = false;

	var email_val = document.theForm.email.value;
	var from_site_val = document.theForm.from_site.value;
	var is_window_val = document.theForm.is_window.value;
	var org_referer = document.theForm.org_referer.value;

	var thisurl_string = thisurl + "?email=" + email_val + "&from_site=" + from_site_val + "&is_window=" + is_window_val + "&org_referer=" + org_referer;

	if ( CanAnimate ) {
			msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=240,top=0,left=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl_string;
	}
	else {
			msgWindow=window.open( thisurl_string,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=240,top=0,left=0');
	}
}


browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
if (condition == true  )
    CanAnimate = true;
else
    CanAnimate = false;


//use in trustseal code
function openchild_ts(thisurl){
	if ( CanAnimate ){
		 var windowHeight;
		 var windowWidth;
		 var windowTop;
		 var windowLeft;
		 windowHeight=(screen.height*(80/100))*0.85;
		 windowWidth=(screen.width*(57/100)-200);
		 windowTop=(screen.height*(20/100))*0.8;
		 windowLeft=screen.width*(40.2/100);
		 msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,top='+windowTop+',left='+windowLeft+',width='+windowWidth+',height='+windowHeight);
		 msgWindow.focus();
		 msgWindow.location.href = thisurl;
	}
	else {
		msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=510,height=420');
	}

}

//for open vidio's
var win = null;

function NewWinIM(mypage,myname,compname)
{
var embedcode = '<div align="center"><embed id="VideoPlayback" style="width:400px;height:326px" allowFullScreen="true" src="http://video.google.com/googleplayer.swf?docid='+mypage+'&hl=en&fs=true&autoplay=1" type="application/x-shockwave-flash"> </embed></div>';
LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
TopPosition = (screen.height) ? (screen.height-326)/2 : 0;

var settings = 'width=440';
settings += ', height=366';
settings += ', top='+TopPosition+', left='+LeftPosition;
settings += ', directories=no';
settings += ', location=no';
settings += ', menubar=no';
settings += ', resizable=no';
settings += ', scrollbars=no';
settings += ', status=no';
settings += ', toolbar=no';

win = window.open("",myname,settings);
win.document.write('<HTML><HEAD><TITLE>'+compname+' Video</TITLE></HEAD><BODY BGCOLOR="#000000"><DIV style="color:white;font-size:11px;font-family:arial" align="center">Video by '+compname+'</DIV>'+embedcode+'</BODY></HTML>');
}



function red(xid)
{
	document.getElementById(xid).className = "wh1";
}


function blue(xid)
{
	document.getElementById(xid).className = "wh";
}

function funcTextNewWindow(url){
	window.open(url);

}


function listing()
{
document.getElementById('list1').style.width="63%";
}