// 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, '');

	Form.ss.value = Form.ss.value.replace(/[^a-zA-Z0-9+ ]/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")
                {
			var str1 = Form.ss.value.replace(/\+/g, ' ');
			str1 = escape(str1.replace(/\s+/g, '+'));
                        str +='ss='+str1;
			//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")
                {
			var str2 = Form.ss.value.replace(/\+/g, ' ');
			str2 = escape(str2.replace(/\s+/g, '+'));
                        str +='ss='+str2;
			//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")
                {
			var str3 = Form.ss.value.replace(/\+/g, ' ');
			str3 = escape(str3.replace(/\s+/g, '+'));
                        str +='search='+str3;
			//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")
		{
			var str4 = Form.ss.value.replace(/\+/g, ' ');
			str4 = escape(str4.replace(/\s+/g, '+'));
                        str +='ss='+str4;
			//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');
	}

}

//use in trustseal code on enquiry thank you page
function openchildts(thisurl)
{
	if( CanAnimate )
	{
		var windowHeight;
		var windowWidth;
		var windowTop;
		var windowLeft;
		windowHeight=(screen.height*(80/100))*0.85;
		windowWidth=screen.width*(57/100);
		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 NewWinIM(mypage,myname,compname)
{
var arr = mypage.split("/");
var comp_name =compname.replace(/\#/g,'\'');
var link_url = url.substr(0,30);
var link_url1 = url.substr(30,100);
var mix_url =''+link_url+'<br>'+link_url1+'';

var embedcode='';

if (mypage.search(/heavy\#\#/) != -1){
mypage = mypage.replace('heavy##','');
embedcode = '<div align="center"><object type="application/x-shockwave-flash" data="http://www.videowebtown.com/community/flvplayer/flvplayer.swf?file=http://www.videowebtown.com/indiamartvideo/video/'+mypage+'.flv&autoStart=false" width="352" height="288" wmode="transparent"><param name="movie" value="http://www.videowebtown.com/community/flvplayer/flvplayer.swf?file=http://www.videowebtown.com/indiamartvideo/video/'+mypage+'.flv"><param name="wmode" value="transparent"><embed  src="http://www.videowebtown.com/community/flvplayer/flvplayer.swf?file=http://www.videowebtown.com/indiamartvideo/video/'+mypage+'.flv&autoStart=false" quality="high" bgcolor="#ffffff" width="352" height="288" name="movie" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></object></div>';
}
else
{

embedcode = '<DIV CLASS="sec-div"><embed src="http://www.4shared.com/flash/flvplayer.swf" style="width:400px;height:326px" bgcolor="#ffffff" allowscriptaccess="always" allowfullscreen="true" flashvars="file=http://dc152.4shared.com/img/'+arr[0]+'/'+arr[1]+'/dlink__2Fdownload_2F'+arr[0]+'_2F'+arr[1]+'_3Fdsid_3DJGITKOINJZHYGJIAJPJYHXISIQKIJFIVHXHZHYJIIZJBJPIWKSIRKQITIGJTIAGHGCIAHYJHINIQKVKU/preview.flv&image=http://dc152.4shared.com/img/'+arr[0]+'/'+arr[1]+'/'+arr[2]+'&autostart=true"></embed></div>';

// 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);

}




//////// Blowup Code //////////

var myWidth = 0, myHeight = 0;


function bhw()
{
	if( typeof( window.innerWidth ) == 'number' ) {
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
	}
	var h = window.pageYOffset ||
	document.body.scrollTop ||
	document.documentElement.scrollTop;
	var browserName=navigator.appName; 
	
	var imagedivheight=myHeight-60;
	var test = myWidth*24/100;
	var divwidth = myWidth-test;
	var widthformizilla = myWidth-538;
	var mozillawidth = widthformizilla-divwidth;
	var iewidth = myWidth-516;
	
	var mozillawidth1 = mozillawidth/2;
	var iewidth1 = iewidth/2;
	
	var mtop = h+7;
	var aboveheight = myHeight-584;
	var aboveheight1 = aboveheight/2+h;
	
	
	
	document.getElementById('divscroll').style.height="500px";
	document.getElementById('divscroll').style.width="504px";
	document.getElementById('blwtbl').style.height="478px";
	document.getElementById('message2').style.top=aboveheight1+'px';
	document.getElementById('message2').style.left=iewidth1+'px';
	document.getElementById('divscroll').name="miniwin";
	
	
	
	if (myHeight <= 586)
	{
		document.getElementById('divscroll').style.height=imagedivheight+'px';
		document.getElementById('divscroll').style.width="522px";
		document.getElementById('blwtbl').style.height=imagedivheight+'px';
		document.getElementById('message2').style.top=mtop+'px';
	}
}



function max()
{
	var imagedivheightnew=myHeight-60;
	var imagedivwidthnew=myWidth-212;
	var imagedivheightnew1=myHeight-94;
	
	
	var h = window.pageYOffset ||
	document.body.scrollTop ||
	document.documentElement.scrollTop;
	var browserName=navigator.appName; 
	var mtop = h+7;
	
	
	
	if (document.getElementById('divscroll').name=="miniwin")
	{
		document.getElementById('message2').style.left="100px";
		document.getElementById('message2').style.top=mtop+'px';
		document.getElementById('divscroll').style.width=imagedivwidthnew+'px';
		document.getElementById('divscroll').style.height=imagedivheightnew+'px';
		document.getElementById('blwtbl').style.height=imagedivheightnew1+'px';
		document.getElementById('divscroll').name="maxwin";
		document.getElementById('mx').className="doff";
		document.getElementById('mx1').className="don";
	}
	else
	{
		document.getElementById('mx').className="don";
		document.getElementById('mx1').className="doff";
		bhw();
	}
}



function blowup_show()
{
	document.getElementById('message2').className="don";
	bhw();
}




function blowup_off()
{
	document.getElementById('message2').className="doff";
}


var path = '';
var imgid = "0";

function imageset(id,img_path)
{

//	set_big_img_path(id);
	document.getElementById('loadimg').className="don";
	document.getElementById('imagediv').className="doff";
	path = img_path;


	imgid = id;
	var pic = document.getElementById(imgid);
	productName =pic.alt;
	productName = unescape(productName);
	if(productName.length > 40)
        {
		var c = productName.substring(0,40);
		c = c + "...";
		productName = c;
        }

	document.getElementById('imagediv').innerHTML='<img src="'+path+'" onload="loadimg()" id="bigimg">'; 
	document.getElementById('prname').innerHTML=productName;
	document.getElementById('mx').className="don";
		document.getElementById('mx1').className="doff";
}



// function set_big_img_path(imgid)
// {
// 	document.getElementById('loadimg').className="don";
// 	document.getElementById('imagediv').className="doff";
// 
// 	var k = dataref.length-1;
// 	if(k >= 0)
// 	{
// 		var i = imgid-1;
// 		path = eval("dataref["+i+"].img_path");
// 
// 	}
// }


function keyDown(e)
{
	var n = (window.Event) ? e.which : e.keyCode;

	if(n==9 && document.getElementById('message2').className=="don")
	{
		return false;
	}
	else if(n==32 && document.getElementById('message2').className=="don")
	{
		return false;
	}
	else if(n==27 && document.getElementById('message2').className=="don")
	{
		blowup_off();
	}
}


function loadimg()
{
	document.getElementById('loadimg').className="doff";
	document.getElementById('imagediv').className="don";
}


document.write('<DIV ID="message2" STYLE="position: absolute; top: 0px; left: 0px; z-index: 2000; ALIGN="center" class="doff"><TABLE ID="tableheight" ALIGN="center" BORDER="1" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="center"><TABLE CLASS="bgclor"  BORDER="0" CELLPADDING="0" CELLSPACING="0" width="100%"><TR><TD ALIGN="center"><TABLE CLASS="main1" ALIGN="center" BORDER="0" CELLPADDING="0"  CELLSPACING="0" WIDTH="100%" HEIGHT="35" ><TR><TD ID="titleBar"  STYLE="cursor:move"><ILAYER WIDTH="100%" ONSELECTSTART="return false"> </ILAYER><LAYER WIDTH="100%" ONMOUSEOVER="isHot=true;if (isN4) ddN4(message2)" ONMOUSEOUT="isHot=false"><DIV ID="prname" CLASS="pr-txt"></DIV></LAYER></TD><TD ALIGN="right" STYLE="padding-right:0px;" WIDTH="100"><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD><IMG SRC="/gifs/max1.gif" id="mx" WIDTH="21" HEIGHT="21" STYLE="cursor:pointer" ONCLICK="max()" HSPACE="3"></TD><TD><IMG SRC="/gifs/max.gif" id="mx1" WIDTH="21" HEIGHT="21" STYLE="cursor:pointer;" class="doff" ONCLICK="max()" HSPACE="3"></TD><TD><IMG SRC="/gifs/cl.gif" WIDTH="21" HEIGHT="21" ONCLICK="blowup_off()" STYLE="cursor:pointer"></TD></TR></TABLE></TD></TR></TABLE><DIV STYLE="height: 500px; width: 504px;" CLASS="image_div" ID="divscroll" ALIGN="center"><TABLE ID="blwtbl" ALIGN="center" BGCOLOR="#ffffff" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR><TD ALIGN="center"><DIV ID="loadimg" STYLE="font-family: arial; font-size: 15px;" class="doon"><IMG SRC="/gifs/indicator-new.gif"><BR><BR>Loading...</DIV><DIV ID="imagediv" class="doff"></DIV></TD></TR></TABLE></DIV></TD></TR></TABLE></TD></TR></TABLE></DIV>'); 


isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.message2 : document.getElementById("message2");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx+'px'; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety+'px';
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.message2.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.message2.visibility="show";
}

document.body.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

/////// End of blowup code /////////

function hover(obj)
{
if (document.getElementById(obj).className=="img_box2")
	{
document.getElementById(obj).className="img_box_new";

	}
else
	{
	document.getElementById(obj).className="img_box2";
	}


}



function hovernew(obj)
{
if (document.getElementById(obj).className=="h_r_bor1")
	{
document.getElementById(obj).className="h_r_bor";

	}
else
	{
	document.getElementById(obj).className="h_r_bor1";
	}


}


