$(document).ready(function(){
});

/*
* This method redirects user to specified company.
*/ 
function redirect(company_id,company_name)
{
	if(company_id)
	{
		var url='';
		url="/companydetails.php/company_id/"+company_id+'/company_name/'+company_name;
		window.location.replace(url);
	}
	return false;
}

/*
* This method redirects user to specified company.
*/ 
function newredirect(company_id,img,category_id,level)
{
	//http://dev.export.is/category_companies.php?company_id=347&img=5&category_id=2&level=1
	if(company_id)
	{
		var url='';
		url="/category_companies.php?company_id="+company_id+'&img='+img+'&category_id='+category_id+'&level='+level;
		window.location.replace(url);
	}
	return false;
}

/*
* This method sets val to textbox.
*/
function setsearchtext(searchval)
{
	//var pathname = window.location.pathname; 
	//var var1 = pathname.split("/");
	//$(this).attr("href").replace(/\s/g,"%20"); 
	//var test = var1[3].replace('%20'," "); 
	//$('#str').val(var1[3]);
	//alert(test);
	$('#str').val(searchval);
}

function change_width()
{
	$('#cpv_text').css({'width':'auto'});
}

/*This method is just interface and 
  does not provide any kind of functionality*/
function no_operation()
{
	//return false;
}

/*This function displays page which is called by user*/
function show_info(url)
{
//document.getElementById("ajaxmenubutton").value="1";
	//var url = $(url).attr("title");
	$('#main_container').css({'padding-left':'5px'});

	div = $("<div class='ajaxwrapper'>").html("<img src='/images/loading.gif' alt='WAIT...'/>");
	if($("#topmenuimageswrapper").length)
	{
		$("#output").html(div); 
		url = url + "/domexists/1";
	}
	else
		$("#main_container").html(div);

	//$.get("/info_content.php", { url: url },
			urldev = url.replace("export", "dev.export")
			urldev = urldev.replace("www.", "")
			$.get(urldev, { url: url },
			//$.get("/info_content.php", { url: urldev },					
			function(data){
                 
				 //$('#main_container').html(data);
				 document.getElementById('main_container').innerHTML = data;
				 $('ul.jd_menu').jdMenu();
				 seturl();
		});
	return false;
}

/*function get_data(cpv_lang)
{
	$("#ajax_wait").ajaxStart(function(){
   		$(this).show();
 	});
	$.get("/get_data.php", { cpv_lang: cpv_lang },
 			 function(data){
 				   $('#cpv_text').html(data);
 			 });
  	$("#ajax_wait").ajaxStop(function(){
   		$(this).hide();
 	});
	
 return false;
}*/

/* This function set url for the anchor tag which you get 
   in the 'output' div.	
*/
function seturl()
{
jQuery("#output").find("a").each(function(i){
		//alert($(this).attr('href'));
		var url = $(this).attr('href');
		pos = url.search('www.');
		if(pos == -1)
		{
			url = "show_info('"+url+"')";
			$(this).attr("href", "javascript:void(0);");
			$(this).attr("onclick", url);
		}
});
}

function ChangeComboSize()
{
	 //$('.textoption').css({"width":"auto",'border':'1px solid red'});
}


/*$(function() {
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
});*/
