﻿$(document).ready(function() {

	//If we're working on localhost, subst the image.ashx with xxx.metadata.gr/image.ashx
	if ($(window).attr('location').toString().match("localhost") != null) {
		$('img[src*=Image.ashx]').attr('src', function() {
			return 'http://www.zougla.gr/' + $(this).attr('src');
		});
	}
	
	// If we're working on localhost, subst the image.ashx with xxx.metadata.gr/image.ashx
	if ($(window).attr('location').toString().match("localhost") != null) {
		$('img[src*=uploads/]').attr('src', function() {
			return 'http://www.zougla.gr/' + $(this).attr('src');
		});
	}
	
	//If we're working on http://zougla.metadata.gr/, subst the image.ashx with xxx.metadata.gr/image.ashx
	if ($(window).attr('location').toString().match("zougla.metadata.gr") != null) {
		$('img[src*=Image.ashx]').attr('src', function() {
			return 'http://www.zougla.gr/' + $(this).attr('src');
		});
	}
	
	// If we're working on http://zougla.metadata.gr/, subst the image.ashx with xxx.metadata.gr/image.ashx
	if ($(window).attr('location').toString().match("zougla.metadata.gr") != null) {
		$('img[src*=uploads/]').attr('src', function() {
			return 'http://www.zougla.gr/' + $(this).attr('src');
		});
	}
	
});