//*******powerportel code  ***

function wopen(url, name, w, h)
{
w += 32;
h += 96;
 var win = window.open(url,
  name, 
  'width=' + w + ', height=' + h + ', ' +
  'location=no, menubar=no, ' +
  'status=no, toolbar=no, scrollbars=yes, resizable=no');
 win.resizeTo(w, h);
 win.focus();
}


//*******Search code  ***
function searchvalidation()
{
var txtsearch=document.getElementById("searchtext");
    if(txtsearch.value==""||txtsearch.value=="Search")
    {
        txtsearch.value="Please enter text";
        return false;
    }
    return true;
}

    function changeyear()
      {
      var ctrl=document.getElementById("ddyear");
        window.location="pressroom.aspx?year="+ctrl.options[ctrl.selectedIndex].value;
     }
     
      function getsearchdata()
      {
        var stext=document.getElementById("txtsearchtext").value;
        var btype=1;
        if(document.getElementById("rdExactMatch").checked==true)
        {
            btype=0;
        }
        else if(document.getElementById("rdAllWord").checked==true)
        {
          btype=2;
        }
        window.location="search.aspx?searchtext="+stext+"&typeofsearch="+btype;
      //ajaxRequest(null,'true','GET','','search.aspx?searchtext='+stext+'&typeofsearch='+btype+'&pagenumber=0&strip=strip&test=test','myspan');
      return false;
      }
      
function querySt(ji) {

hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
if(ft[1]!=null)
{
return ft[1];
}else
{return 1;}
}
}


return 1;
}

//*******Validation code  ***

// JavaScript Document
function validateFrmContact()
{
	var frm = document.getElementById('frmContact');
	if(IsEmpty(frm.company) || frm.company.value == 'Company Name*'){
		alert("Please enter company name.");
		frm.company.focus();
		return false
	}
	if(IsEmpty(frm.name) || frm.name.value == 'Your Name*'){
		alert("Please enter your name.");
		frm.name.focus();
		return false
	}
	if(!isValidEmail(frm.email.value) || frm.email.value == 'Email Address*'){
		alert("Please enter the valid email address.");
		frm.email.focus();
		return false
	}
	if(IsEmpty(frm.phone) || frm.phone.value == 'Phone*'){
		alert("Please enter phone number.");
		frm.txtPhone.focus();
		return false
	}
	
}

function hideDefaultText(element, defaultVal)
{
	if(element.value == defaultVal||element.value=="Please enter text"){
		element.value =	'';
	}
}

function showDefaultText(element, defaultVal)
{
	if(element.value == ''){
		element.value =	defaultVal;
	}
}

function IsEmpty(aTextField) {

	var regexp = /^(\s)*$/

	if(regexp.test(aTextField.value)){
		return true;

	}else{
		return false;
	}

}//IsEmpty

function getTag()
      {
      var stext=document.getElementById("txttag").value;
      window.location="showtag.aspx?TagName="+stext;
      return false;
      }

function isValidEmail(el)
{        
		var str=el;
		var filter=/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;

		var testresults;
		if (filter.test(str))
			return true;
		else 
			return false;
}

//*******fade for Tab code  ***
$(document).ready(function(){ 
$('#tabs #tab-1').hide(); // Hide all divs 
$('#tabs #tab-2').hide(); // Hide all divs 
$('#tabs #tab-3').hide(); // Hide all divs 
$('#tabs #tab-4').hide(); // Hide all divs 
$('#tabs #tab-5').hide(); // Hide all divs 
$('#tabs #tab-6').hide(); // Hide all divs 
//$('#tabs div:first').show(); // Show the first div 
$('#tabs #tab-1').show();

$('#newtab ul li :first').addClass('active'); //Set the first link's class to active 
$('#newtab ul li a').click(function()
								  { //When any link is clicked 

$('#newtab ul li').removeClass('active'); //Remove active class from all links 

$(this).parent().addClass('active'); //Set clicked link class to active 
var currentTab = $(this).attr('href'); // Set variable currentTab 
$("#tabs #tab-2").fadeOut("slow",function(){ //fade out visible div 
$('#tabs #tab-1').hide(); 
$('#tabs #tab-2').hide(); 
$('#tabs #tab-3').hide(); 
$('#tabs #tab-4').hide(); 
$('#tabs #tab-5').hide(); 
$('#tabs #tab-6').hide(); 
$(currentTab).fadeIn("slow") //fade in target div 
});return false; 

}); 
});

//*******popup code  ***
$(document).ready(function() {
	
	$("a.group").fancybox({
		'hideOnContentClick': true
	});
});



