﻿ // hide divs
function hide(id){
var divObject=document.getElementById(id);
divObject.style.display="none";
}
// shows divs
function show(id){
var divObject=document.getElementById(id);
divObject.style.display="block";
}
// hide and show divs
function hide_show(id){
var divObject=document.getElementById(id);
if (divObject.style.display=="none") divObject.style.display="block"; else divObject.style.display="none";
}
// change product pictures
function change_picture(picture){
document.getElementById('detail_picture').src=picture;
}
// open popup window
function open_popup(pW,pH,url){
var winl = (screen.width - pW) / 2;
var wint = (screen.height - pH) / 2;
winprops = 'top='+wint+',left='+winl+',height=' + pH + ',width='+ pW +',scrollbars=yes,resizable=no,status=no';
window.open(url,'',winprops);
}
// check all checkboxes
function check_all() {
	for (var i=0;i<document.basket.elements.length;i++) {
		var e=document.basket.elements[i];
		if (e.name != 'checkall')
		e.checked=document.basket.checkall.checked;
    }
}
//check the phone number
function check_phone(obj) {
	var rgpxp = new RegExp(/[-\( \/]*(0{1})?[-\)\( \/]*([\d]{3})[-\) \/]*([1-9]{1})([\d]{2})[- \/]*([\d]{2})[- \/]*([\d]{2})+$/);	
	if (obj.value.search(rgpxp) == -1) {
	alert ("Lütfen telefon numaranızı \r\nalan kodu ile birlikte giriniz.")
	} else {
	obj.value=obj.value.replace(rgpxp,"$2-$3$4-$5-$6")
	}
}
