function stopError() {
return true;
}
window.onerror = stopError;

var v ;



//

ajax = function(rappel, method, url, flux){
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() :
       (window.ActiveXObject ?  new ActiveXObject("Microsoft.XMLHTTP") : '');

if (xhr) {
        xhr.onreadystatechange = function () {rappel(xhr);}
        xhr.open(method,  url, true);
        xhr.send(flux);
    } else alert("Ajax ?");
}


isReady = function(xhr, f) {
    if ( xhr.readyState == 4) {
                if (xhr.status != 200)
                      {alert('Erreur HHTP :  ' +  xhr.status);}
                else  { f(xhr.responseText); }
        }
}

function insereReponse(r) {
        document.getElementById('mst').innerHTML = r
}


include = function(form){
            url = 'spvot.php?do=show&ID=' + form.part.value +'&depid='+form.depid.value;
for (var i = 0; i < document.form.vote.length; i++) {
  if (document.form.vote[i].checked) {
    url=url+"&vote=" + document.form.vote[i].value;
  }
}

  document.getElementById('mst').innerHTML = '<div align="center"><img src="1-1.gif" alt="www.egyfanz.com" /> <br /><font style="color:#ffffff; font-size:7pt;"> انتظر قليلا</font> </div>';


     ajax(function (xhr) {isReady(xhr, insereReponse);} , 'POST', url, null);
     return false;
}


$(function() {

$("form.expose").bind("click keydown", function() {
 $(this).expose({

 maskId: 'mask',

 onLoad: function() {
 this.getExposed().css({Color: '#000'});
 },

 onClose: function() {
  this.getExposed().css({backgroundColor: 'transparent'});
  },
  api: true
  }).load();
  });
  });

$(document).ready(function(){

	$(".toggle_container").hide();

	$("h2.trigger").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	$("h2.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow");
	});

});
 $("h2.trigger").click(function () {
      $(".toggle_container").toggle("slow");
    });

$(document).ready(function() {

	//Show Banner
	$(".main_image .desc").show(); //Show Banner
	$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$(".searchh ul li:first").addClass('active');
	$(".searchh ul li").click(function(){
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
		var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block

		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser
			$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
				$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
			});
		}

		$(".searchh ul li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;

	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});

	//Toggle Teaser
	$("a.collapse").click(function(){
		$(".main_image .block").slideToggle();
		$("a.collapse").toggleClass("show");
	});

});

$(document).ready(function() {

	//Show Banner
	$(".main_image .desc").show(); //Show Banner
	$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$(".header_menu div li:first").addClass('active');
	$(".header_menu div li").click(function(){
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
		var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block

		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser
			$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
				$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
			});
		}

		$(".header_menu div li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;

	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});

	//Toggle Teaser
	$("a.collapse").click(function(){
		$(".main_image .block").slideToggle();
		$("a.collapse").toggleClass("show");
	});

});
$(document).ready(function() {

	//Show Banner
	$(".main_image .desc").show(); //Show Banner
	$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$(".image_thumb div li:first").addClass('active');
	$(".image_thumb div li").click(function(){
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
		var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block

		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser
			$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
				$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
			});
		}

		$(".image_thumb div li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;

	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});

	//Toggle Teaser
	$("a.collapse").click(function(){
		$(".main_image .block").slideToggle();
		$("a.collapse").toggleClass("show");
	});

});

	$(document).ready(function(){

		$("a#in").click(function(event){
			$("div#box").fadeIn("slow");
		});

	$("div#box2").click(function(event){
			$("div#box").hide();
		});
		$("a#show").click(function(event){
				$("div#box").show();
		});

		$("a#slide").click(function(event){
				$("div#box").slideDown("slow");
		});

	});



var rotateSpeed = 5000; // Milliseconds to wait until switching tabs.
var currentTabArr = new Array(); // Set to a different number to start on a different tab.

currentTabArr[1] = tabs_getCookie(1);
currentTabArr[2] = tabs_getCookie(2);
currentTabArr[3] = tabs_getCookie(3);


var numTabs; // These two variables are set on document ready.
var autoRotate;

function openTab(clickedTab) {
	parentTab = clickedTab.parents(".tabbed-box").eq(0);

	var thisTab = $(".tabs a",parentTab).index(clickedTab);
	$(".tabs li a",parentTab).removeClass("active");
	$(".tabs li a:eq("+thisTab+")",parentTab).addClass("active");
	$(".tabbed-content",parentTab).hide();
	$(".tabbed-content:eq("+thisTab+")",parentTab).show();



	currentTabArr[parseInt(parentTab.find(".tabs").attr("id").substring(4))] = thisTab;
	tabs_setCookie(parseInt(parentTab.find(".tabs").attr("id").substring(4)),thisTab);
}


$(document).ready(function() {



	if($.browser.msie && $.browser.version=="6.0"){
		IE6 = true;
	} else IE6 = false;


	$(".tabbed-box").each(function(i,itm){

		$(".tabs li:first",$(itm)).find("a").css("borderRight","none");

		//$(".tabs li:last",$(itm)).css("width","131px");
		//$(".tabs li:last",$(itm)).css("width","131px").find("a").css("borderLeft","none");

		if(IE6)
			$(".tabs li:last",$(itm)).find("a").css("padding","7px 2px 7px");
		else
			$(".tabs li:last",$(itm)).find("a").css("padding","7px 0 7px 3px");

	});




	$(".tabbed-box .tabs li a").click(function() {
		openTab($(this)); return false;
	});



	$(".tabbed-box").each(function(i,itm){
		tabid = parseInt($(itm).find(".tabs").eq(0).attr("id").substring(4));



			if(tabid != NaN && is_int(tabid)){
				$(itm).find(".tabs li a:eq("+currentTabArr[tabid]+")").click();
				}
			}
		);

});

function is_int(input){
    return typeof(input)=='number'&&parseInt(input)==input;
  }



function tabs_setCookie(name, value){
	var re=new RegExp("preferred_tabs=[^;]+", "i"); //construct RE to search for target name/value pair
	var preferred_tabs = "";
	if (document.cookie.match(re)){ //if cookie found
		preferred_tabs = document.cookie.match(re)[0].split("=")[1];
	}



	tab = preferred_tabs.split(',');
	tab[name] =  v  = value;
	var preferred_tabs = tab[0]+","+tab[1]+","+tab[2]+","+tab[3];
	var name  = "preferred_tabs";
	var value = preferred_tabs;




	var expDays = 180;
	var exp = new Date();
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

	document.cookie = name + "=" + value + "; expires=" + exp.toGMTString() +
	"; domain=.egyfanz.com";
	return v;
}


function tabs_getCookie(Name){

	var re=new RegExp("preferred_tabs=[^;]+", "i"); //construct RE to search for target name/value pair
	var preferred_tabs = "";
	if (document.cookie.match(re)){ //if cookie found
		preferred_tabs = document.cookie.match(re)[0].split("=")[1];
	}


	Name = parseInt(Name);

	tab = preferred_tabs.split(',')





	if(tab[Name] == "undefined"){
			tab[Name] = undefined;
		}

	if(Name == 0){
		if(tab[0] != undefined){ // unused
			 	return tab[0];
		} else return tabs_setCookie(0,3);
	}
	if(Name == 1){
		if(tab[1] != undefined){
			return tab[1];
		} else return tabs_setCookie(1,0);// default for blog  TABIDGROUP starts from 1,TABID starts from 0
    	//return 'sport';
	}
	if(Name == 2 ){
		if(tab[2] != undefined){
			return tab[2];
		} else return tabs_setCookie(2,0);
	}
	if(Name == 3){
		if(tab[3] != undefined){
			return tab[3];
		} else return tabs_setCookie(3,0);
	}

	return "";
}



function lightup2(obj)

{

obj.className=(obj.className=='ahmed'?'mohamed':'ahmed')

}
function lightup3(obj)

{

obj.className=(obj.className=='homos'?'homos2':'homos')

}
//Specify affected tags. Add or remove from list:
var tgs = new Array( 'td','tr','p');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 1;

function ts( trgt,inc ) {
        if (!document.getElementById) return
        var d = document,cEl = null,sz = startSz,i,j,cTags;

        sz += inc;
        if ( sz < 0 ) sz = 0;
        if ( sz > 5 ) sz = 5;
        startSz = sz;

        if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

        cEl.style.fontSize = szs[ sz ];

        for ( i = 0 ; i < tgs.length ; i++ ) {
                cTags = cEl.getElementsByTagName( tgs[ i ] );
                for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
        }
}
function SendEmail2()
{
	var email=document.getElementById("email").value ;
	var name=document.getElementById("name").value;


	if(!email || email=='بريدك هنا' )
	{
	alert('من فضلك تاكد من ادخال بريدك');
	}
	else
	{
		showResult3030_par33_('savelist',name,email);

	}

}
function DoSearch()
{
	var Ser=document.getElementById ("srch_fld").value;
	var CatId=document.getElementById ("catid").value;
	var Chk=document.getElementById ("chk").value;

	if(Ser==Chk || !Ser){alert('تاكد من مضمون البحث');}
	else
	{
	location='search.php?catid='+ CatId +'&ser='+Ser;
	}
}
function DoSearch200()
{

	var Ser=document.getElementById ("srch_fld2").value;
	var CatId=document.getElementById ("catid2").value;
	var Chk=document.getElementById ("chk2").value;

	if(Ser==Chk || !Ser){alert('تاكد من مضمون البحث');}
	else
	{
	location='search.php?catid='+ CatId +'&ser='+Ser;
	}
}
function ForPar(Faction,txt1name,txt1value)
{	document.getElementById("ForPar").action=Faction;
	document.getElementById('txt1').name=txt1name;
	document.getElementById('txt1').value=txt1value;
	document.getElementById("ForPar").submit();}

