$(document).ready(function() {
						   
// Tooltip jquery

	$('a[rel=tooltip]').mouseover(function(e) {
		var tip = $(this).attr('title');	
		$(this).attr('title','');
		$(this).append('<div id="tooltip"><div class="tipHeader"></div><div class="tipBody">' + tip + '</div><div class="tipFooter"></div></div>');		
		$('#tooltip').fadeIn('500');
		$('#tooltip').fadeTo('10',0.9);
		
	}).mousemove(function(e) {
		$('#tooltip').css('top', e.pageY + 10 );
		$('#tooltip').css('left', e.pageX + 20 );
		
	}).mouseout(function() {
		$(this).attr('title',$('.tipBody').html());
		$(this).children('div#tooltip').remove();
	});

	$('#nav').hover(
		function () {
			//show its submenu
			$('ul', this).slideDown(100);

		}, 
		function () {
			//hide its submenu
			$('ul', this).slideUp(100);			
		}
	);
	
	hs.lang = {
		creditsText : '',
		creditsTitle : ''
	},
	
	hs.graphicsDir = '/images/hs/';
	hs.align = "center";
	hs.dimmingOpacity = 0.50;
	hs.fadeInOut = true;
	hs.outlineType = 'rounded-white';
	hs.wrapperClassName = 'draggable-header';

	$('#q').blur(function()
	{
		if($('#q').val() == "")
		{
			$('#q').css("background",'#FFFFFF url(https:\x2F\x2Fwww.google.com\x2Fcse\x2Fintl\x2Fde\x2Fimages\x2Fgoogle_custom_search_watermark.gif) left no-repeat') ;
		}
	});
	
	$('#q').focus(function()
	{
		$('#q').css("background",'#FFFFFF') ;
	});
	
	if($('#q').val() == "")
	{
		$('#q').css("background",'#FFFFFF url(https:\x2F\x2Fwww.google.com\x2Fcse\x2Fintl\x2Fde\x2Fimages\x2Fgoogle_custom_search_watermark.gif) left no-repeat') ;
	}
});


function validateEmail(email)
{
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}

function ShowForgotPasswordBox()
{
forgot = document.getElementById('forgotpass');

if(forgot.style.display == 'none')
	forgot.style.display = 'block';
else
	forgot.style.display = 'none';
		
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function redirect_ip_popup()
{
	if(getCookie('IS_REDIRECT'))
	{
		if(getCookie('REDIRECT_URL') != "")
		{	
			location.href=getCookie('REDIRECT_URL');
		}
		return;
		
	}
}

function html_get_ip_country_popup(url,qstring,div)
{
	if (url.length==0)
	{
		return;
	}
	if(getCookie('IS_REDIRECT'))
	{
		if(getCookie('REDIRECT_URL') != "")
		{	
			location.href=getCookie('REDIRECT_URL');
		}
		return;
		
	}
	$.ajax({
		url: url,
		data:'',
		success: function(data) {
			if(data != 'false' && data != ''){
				hs.lang = {
					creditsText : '',
					creditsTitle : ''
				},
				hs.graphicsDir = 'images/hs/';
				hs.outlineType = 'rounded-white';
				hs.align = 'center';
				hs.wrapperClassName = 'draggable-header';
				hs.htmlExpand( document.getElementById('anchor'),{maincontentText:data,width:300});
			}
		}
	});

}


function RunActiveContent()
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="770" height="210" id="preview" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="slider/slider.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#FFFFFF" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="slider/slider.swf" quality="high" bgcolor="#FFFFFF" width="770" height="210" name="preview" align="middle" wmode="transparent" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function htmlData(url,qstring,div)
{
	if (url.length==0)
	{
		document.getElementById(div).innerHTML="";
		return;
	}
	
	$.ajax({
		url: url,
		data:'',
		success: function(data) {
		document.getElementById(div).innerHTML=data;
		}
	});
	
}

function preloadImages()

{

  if(document.images)

  {

    if(!document.imageArray) document.imageArray = new Array();

    var i,j = document.imageArray.length, args = preloadImages.arguments;

    

    for(i=0; i<args.length; i++)

    {

      if (args[i].indexOf("#")!=0)

      {

        document.imageArray[j] = new Image;

        document.imageArray[j++].src = args[i];

      }

    }

  }

}
// header all condition menu
/////////////////////////////////////////////////////////////////
// 	the following code block is for All condition right side menu
var timerHandler;
var timerStatus = false;
var alcondmenu = function()
	{
		$('#the_menu').slideUp('slow');
		timerStatus = false;

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

 	
	$("#the_menu").mouseleave(function(){
		
		timerHandler =	setTimeout ('alcondmenu()', 500);
		timerStatus = true;
	});
	
	$("#cat_menu").mouseleave(function(){

		timerHandler =	setTimeout ('alcondmenu()', 500);
		timerStatus = true;
	});
 
	$("#the_menu").mouseenter(function(){
		
		if(timerStatus == true)
		{
			clearTimeout(timerHandler);
			timerStatus = false;
		}
	});

	$("#cat_menu").mouseenter(function(){
		
		if(timerStatus == true)
		{
			clearTimeout(timerHandler);
			timerStatus = false;
		}
		else
		{
			 var pTop = $(this).offset().top-60;
			 var pLeft = $(this).offset().left-215;
			 var pWidth = $(this).width();
			 
			 $("#the_menu").css('z-index','9999');	
			 $("#the_menu").slideDown('slow');
		}
		//$(this).hight		
		 /* $("#the_menu").css({
			  top: pTop,
			  left: pLeft
		  }).slideDown('slow');*/

	});
	
});
// 	End of code block 
//////////////////////
