﻿// JScript File

function artizAra(harf) {
    
    var genre=Request.QueryString("GenreId");
    if(genre=="undefined")
    {
        genre="0"
    }
    var GenreName = Request.QueryString("GenreName");
        if(GenreName=="undefined")
    {
        GenreName="TUMU"
    }
     if(harf == "ö")
     {
     harf = "%C3%B6";
     }     
    var url =  "Genres.aspx?GenreName="+GenreName+"&GenreId="+genre+"&ArtistName="+harf;
    //alert(url)
    window.location.href = url;
}
 function WordBookSelect(harf) {
$('#WordBookResult').hide();
    //$('#WordBookResult').html("Lütfen kullanıcı adı giriniz.");
    $.ajax({
	type: 'GET',
	url: 'ajaxService.aspx',
	data: 'cat=WordBookSelect&letter='+harf,
	success: function(ajaxCevap) {
	$('#WordBookResult').fadeIn("slow");
	    //$('#WordBookResult').show("slow");
		$('#WordBookResult').html(ajaxCevap);
		
	}
});

}
var refDetailId = 0;
function ReferenceDetail(no)
{
//alert(no)
    $('#ref-detail').hide();   
    $.ajax({
	type: 'GET',
	url: '/assets/ajax/ajaxHandler.php',
	data: 'cat=ReferenceDetail&RefId='+no,
	success: function(ajaxCevap) {
	$('#ref-detail').fadeIn("slow");
	$('#ref-detail').html(ajaxCevap);
	
	},
	complete: function(x){
	 Shadowbox.setup($('a.option'),{overlayOpacity: 0.8}); 
	}
	
	});
	
	// hoverlarını temizle
	 //$("#design-select > li").addClass("blue");
//$("p:first").css("fontWeight","bold");

//$(".a-ref-detail").css("border","3px solid red");
//.design-select a

//font-weight: bold; display: block; width:149px; color: #FFFFFF;  text-decoration: none; background: #6e6e64 url(../images/left-arrow-back.gif) right top no-repeat;

	//$('#a-ref-detail-'+no).css("background-color","#E8E8E1", "color","#6E6E64", "display","block", "font-weight","bold", "height","14px", "padding","5px 0 1px 10px", "text-decoration","none", "width","148px");


	if (refDetailId == 0) {
	    $(".xxxx:first > a").removeClass("design-select-hover")
	    $(".xxxx:first > a").css("background-color", "#e8e8e1");
	    $(".xxxx:first > a").css("color", "#6e6e64")
	    $(".xxxx:first > a").css("width", "148px");
	}
	
if(refDetailId != no)
{
$('#a-ref-detail-'+no).css("background-color","#6E6E64");
$('#a-ref-detail-'+no).css("color","#ffffff");
$('#a-ref-detail-'+no).css("width","149px");
$('#a-ref-detail-'+no).addClass("design-select-hover");

$('#a-ref-detail-'+refDetailId).removeClass("design-select-hover")
$('#a-ref-detail-'+refDetailId).css("background-color","#e8e8e1");
$('#a-ref-detail-'+refDetailId).css("color","#6e6e64")
$('#a-ref-detail-'+refDetailId).css("width","148px");
}

refDetailId = no;
}

function clientDdl(source, clientside_arguments)
{
//alert(clientside_arguments.Value)
if(clientside_arguments.Value == 0)
    clientside_arguments.IsValid=false;
    else
    clientside_arguments.IsValid=true;
}
function validateCheckBox
(source, clientside_arguments)
{
alert(clientside_arguments.Value)
//if(clientside_arguments.Value == 0)
//    clientside_arguments.IsValid=false;
//    else
//    clientside_arguments.IsValid=true;
}
function UserNameIsFree(userName)
{
if(userName != "")
{
callAjax("divReturn", 'ajaxService.aspx?cat=UserNameIsFree&userName='+userName)
}
else
{
    $('divReturn').innerHTML = "Lütfen kullanıcı adı giriniz.";
}
}
function callAjax(lbl, url)
{


	 var ctr=document.getElementById(lbl);
	  //ctr.innerHTML="Yükleniyor....";///
	  ctr.innerHTML="<br/><IMG SRC='images/loading.html' />";
	  var xmlHttpObj = XMLHTTP_Olustur();
	  if(xmlHttpObj)
	  {
			//Eğer ToplamUye.aspx sayfası parametre alsayda QueryString ile gönderilmesi gerekirdi.
			xmlHttpObj.open("GET",url,true);
			xmlHttpObj.onreadystatechange=function()
			{
				if(xmlHttpObj.readyState==4) 
				{
					//ctr.innerText=xmlHttpObj.responseText;
					//alert(xmlHttpObj.responseText);
					ctr.innerHTML=xmlHttpObj.responseText;
					
				}						
			} 
			xmlHttpObj.send(null);
	  }	  
}
function XMLHTTP_Olustur()
{
	var retval=null;
	try
	{
		retval=new ActiveXObject("Msxml2.XMLHTTP")
	}
	catch(e)
	{
		try
		{
			retval=new ActiveXObject("Microsoft.XMLHTTP")
		} 
		catch(oc)
		{
			retval=null
		}
	}
	if(!retval && typeof XMLHttpRequest != "undefined") 
	{
		retval=new XMLHttpRequest()
	}
	return retval
}
function pageOpenSimple(uri,w,h)
{
var myrandom=Math.round(Math.random()*1000)
var win="win"+myrandom;
window.open(uri,win,'width=' + w + ',height=' + h + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}
function doHighlight(me){
alert('ss')
 me.style.backgroundColor='#ffffff'; 
 me.style.border='#AF6230 1px solid';
}

function doRelease(me){
 me.style.backgroundColor='#e9e9e9'; 
 me.style.border='#E6CFBB 1px solid';
}


 function DoPostBackMtv(btnId){
__doPostBack(btnId,'');     
}
    function handleEnter(e) 
    {
    
    if (e.keyCode==13)
    {
    return true;
    }
    else
    {
    return false;
    }
    }

function geID (e) {
	return document.getElementById(e);
}

function validateForms(type) {
	//var te = new RegExp('^[0-9]{3}[\-][0-9]{7}$');
	var em = new RegExp('^([0-9a-zA-Z]+[-._+&amp;])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$');
	switch(type) {
		case "bayi":
			if (!geID("txtEmail").value.match(em)) {
				alert("Lütfen eposta adresinizin doğruluğundan emin olun");
				return false;
			}
			if(geID("txtBrand").value == "" || geID("txtName").value == "" || geID("txtSurname").value == "" || geID("txtTelephone").value == "" || geID("txtWebSiteName").value == "" || geID("txtEmail").value == "") {
				alert("Lütfen zorunlu alanları doldurunuz");
				return false;
			}
			return true;
		break;
		case "reklam":
			if(geID("txtBrand").value == "" || geID("txtName").value == "" || geID("txtSurname").value == "" || geID("txtTelephone").value == "" || geID("txtWebSiteName").value == "" || geID("txtEmail").value== "") {
				alert("Lütfen zorunlu alanları doldurunuz");
				return false;
			}
			if (!geID("txtEmail").value.match(em)) {
				alert("Lütfen eposta adresinizin doğruluğundan emin olun");
				return false;
			}
			return true;
		break;
		case "yayinci":
			if(geID("txtName").value == "" || geID("txtSurname").value == "" || geID("txtTelephone").value == "" || geID("txtWebSiteName").value == "" || geID("txtEmail").value== "") {
				alert("Lütfen zorunlu alanları doldurunuz");
				return false;
			}
			if (!geID("txtEmail").value.match(em)) {
				alert("Lütfen eposta adresinizin doğruluğundan emin olun");
				return false;
			}
			return true;
		break;
		case "richmedia":
			if(geID("txtBrand").value == "" || geID("txtName").value == "" || geID("txtSurname").value == "" || geID("txtTelephone").value == "" || geID("txtWebSiteName").value == "" || geID("txtEmail").value== "") {
				alert("Lütfen zorunlu alanları doldurunuz");
				return false;
			}
			if (!geID("txtEmail").value.match(em)) {
				alert("Lütfen eposta adresinizin doğruluğundan emin olun");
				return false;
			}
			return true;
		break;
		case "20":
		break;
	}
	return false;
}
